Device to measure angle and get IMU measurements.
Dependencies: mbed commands BLE_API nRF51822
Diff: main.cpp
- Revision:
- 3:a3e1a06c486d
- Parent:
- 2:871b5efb2043
- Child:
- 4:2a5a08b14539
diff -r 871b5efb2043 -r a3e1a06c486d main.cpp --- a/main.cpp Sat May 30 12:26:02 2015 +0000 +++ b/main.cpp Mon Jun 01 15:41:01 2015 +0000 @@ -3,33 +3,70 @@ Serial pc(USBTX, USBRX); +Ticker ticker; +volatile int ledBlink = 1; + +//DigitalOut led(p21); + +/* +void ledInt(){ + led = !led; + NRF_POWER->SYSTEMOFF = 0; + printf("POWER: 0x%x\n", NRF_POWER->SYSTEMOFF); + NRF_POWER->SYSTEMOFF = 1; + } + +void buttonInt(){ + if(ledBlink) { + ticker.detach(); + ledBlink = 0; + led = 0; + } else { + ticker.attach(&ledInt,0.1); + ledBlink = 1; + } + wait(0.25); + + //printf("POWER: 0x%x\n", *((unsigned int *)0x40000500)); + printf("POWER: 0x%x\n", NRF_POWER->SYSTEMOFF); + +} + +*/ int main(void) { pc.baud(19200); - GonioMeter* goniometer = new GonioMeter(); - - pc.printf("Chose option\n"); + //led = 0; + wait(0.01); while(true) { - + //led = 1; if(pc.readable()){ char command = pc.getc(); switch(command){ - case 'a': + case '1': pc.printf("een\n"); goniometer->setMode(0); break; - case 'b': + case '2': pc.printf("twee\n"); goniometer->setMode(1); break; - case 'c': + case '3': pc.printf("drie\n"); goniometer->setMode(2); break; + case '4': + pc.printf("vier\n"); + goniometer->setMode(3); + break; + case '5': + pc.printf("vijf\n"); + goniometer->setMode(4); + break; } } }