Device to measure angle and get IMU measurements.
Dependencies: mbed commands BLE_API nRF51822
Diff: main.cpp
- Revision:
- 4:2a5a08b14539
- Parent:
- 3:a3e1a06c486d
- Child:
- 5:46947b447701
diff -r a3e1a06c486d -r 2a5a08b14539 main.cpp --- a/main.cpp Mon Jun 01 15:41:01 2015 +0000 +++ b/main.cpp Wed Jun 03 15:10:45 2015 +0000 @@ -1,26 +1,28 @@ #include "mbed.h" -#include "GonioMeter.h" +#include "Controller.h" Serial pc(USBTX, USBRX); -Ticker ticker; -volatile int ledBlink = 1; +//Ticker ticker; -//DigitalOut led(p21); +//InterruptIn button(p23); +volatile int ledBlink = 0; + /* + void ledInt(){ - led = !led; - NRF_POWER->SYSTEMOFF = 0; - printf("POWER: 0x%x\n", NRF_POWER->SYSTEMOFF); - NRF_POWER->SYSTEMOFF = 1; + led = !led; } + + void buttonInt(){ if(ledBlink) { - ticker.detach(); - ledBlink = 0; - led = 0; + //ticker.detach(); + //ledBlink = 0; + //led = 0; + *(uint32_t *)0x40000500 = 0x1; } else { ticker.attach(&ledInt,0.1); ledBlink = 1; @@ -28,20 +30,25 @@ wait(0.25); //printf("POWER: 0x%x\n", *((unsigned int *)0x40000500)); - printf("POWER: 0x%x\n", NRF_POWER->SYSTEMOFF); + //printf("POWER: 0x%x\n", NRF_POWER->SYSTEMOFF); } +*/ -*/ int main(void) { pc.baud(19200); - GonioMeter* goniometer = new GonioMeter(); - //led = 0; + Controller* goniometer = new Controller(); + + /* + button.fall(&buttonInt); + + led = 0; + */ wait(0.01); while(true) { - //led = 1; + if(pc.readable()){ char command = pc.getc(); @@ -49,23 +56,23 @@ switch(command){ case '1': pc.printf("een\n"); - goniometer->setMode(0); + goniometer->setCommand(0); break; case '2': pc.printf("twee\n"); - goniometer->setMode(1); + goniometer->setCommand(1); break; case '3': pc.printf("drie\n"); - goniometer->setMode(2); + goniometer->setCommand(2); break; case '4': pc.printf("vier\n"); - goniometer->setMode(3); + goniometer->setCommand(3); break; case '5': pc.printf("vijf\n"); - goniometer->setMode(4); + goniometer->setCommand(4); break; } }