Device to measure angle and get IMU measurements.
Dependencies: mbed commands BLE_API nRF51822
main.cpp@5:46947b447701, 2015-06-07 (annotated)
- Committer:
- dkester
- Date:
- Sun Jun 07 14:11:26 2015 +0000
- Revision:
- 5:46947b447701
- Parent:
- 4:2a5a08b14539
- Child:
- 6:75263c93daf7
Werking
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dkester | 0:1c5088dae6e1 | 1 | #include "mbed.h" |
dkester | 4:2a5a08b14539 | 2 | #include "Controller.h" |
dkester | 0:1c5088dae6e1 | 3 | |
dkester | 0:1c5088dae6e1 | 4 | |
dkester | 4:2a5a08b14539 | 5 | //Ticker ticker; |
dkester | 3:a3e1a06c486d | 6 | |
dkester | 4:2a5a08b14539 | 7 | //InterruptIn button(p23); |
dkester | 4:2a5a08b14539 | 8 | volatile int ledBlink = 0; |
dkester | 4:2a5a08b14539 | 9 | |
dkester | 3:a3e1a06c486d | 10 | /* |
dkester | 4:2a5a08b14539 | 11 | |
dkester | 3:a3e1a06c486d | 12 | void ledInt(){ |
dkester | 4:2a5a08b14539 | 13 | led = !led; |
dkester | 3:a3e1a06c486d | 14 | } |
dkester | 4:2a5a08b14539 | 15 | |
dkester | 4:2a5a08b14539 | 16 | |
dkester | 3:a3e1a06c486d | 17 | |
dkester | 3:a3e1a06c486d | 18 | void buttonInt(){ |
dkester | 3:a3e1a06c486d | 19 | if(ledBlink) { |
dkester | 4:2a5a08b14539 | 20 | //ticker.detach(); |
dkester | 4:2a5a08b14539 | 21 | //ledBlink = 0; |
dkester | 4:2a5a08b14539 | 22 | //led = 0; |
dkester | 4:2a5a08b14539 | 23 | *(uint32_t *)0x40000500 = 0x1; |
dkester | 3:a3e1a06c486d | 24 | } else { |
dkester | 3:a3e1a06c486d | 25 | ticker.attach(&ledInt,0.1); |
dkester | 3:a3e1a06c486d | 26 | ledBlink = 1; |
dkester | 3:a3e1a06c486d | 27 | } |
dkester | 3:a3e1a06c486d | 28 | wait(0.25); |
dkester | 3:a3e1a06c486d | 29 | |
dkester | 3:a3e1a06c486d | 30 | //printf("POWER: 0x%x\n", *((unsigned int *)0x40000500)); |
dkester | 4:2a5a08b14539 | 31 | //printf("POWER: 0x%x\n", NRF_POWER->SYSTEMOFF); |
dkester | 3:a3e1a06c486d | 32 | |
dkester | 3:a3e1a06c486d | 33 | } |
dkester | 4:2a5a08b14539 | 34 | */ |
dkester | 3:a3e1a06c486d | 35 | |
dkester | 0:1c5088dae6e1 | 36 | int main(void) |
dkester | 5:46947b447701 | 37 | { |
dkester | 5:46947b447701 | 38 | wait(1); |
dkester | 4:2a5a08b14539 | 39 | Controller* goniometer = new Controller(); |
dkester | 3:a3e1a06c486d | 40 | wait(0.01); |
dkester | 2:871b5efb2043 | 41 | |
dkester | 0:1c5088dae6e1 | 42 | while(true) { |
dkester | 5:46947b447701 | 43 | goniometer->run(); |
dkester | 0:1c5088dae6e1 | 44 | } |
dkester | 0:1c5088dae6e1 | 45 | } |
dkester | 0:1c5088dae6e1 | 46 | |
dkester | 0:1c5088dae6e1 | 47 |