![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
GPS and IMU reading works
Dependencies: mbed Servo SDFileSystem
Diff: main.cpp
- Revision:
- 2:afb333543af5
- Parent:
- 1:e7245ffb4820
- Child:
- 3:ab9f94d112c0
--- a/main.cpp Sat Aug 08 07:05:21 2015 +0000 +++ b/main.cpp Sat Aug 08 08:01:25 2015 +0000 @@ -1,27 +1,25 @@ #include "mbed.h" -Serial pc(USBTX, USBRX); // tx, rx -Serial device(p28, p27); // tx, rx -char buf[256]; +DigitalOut led1(LED1); +DigitalOut led2(LED2); + +Serial pc(USBTX, USBRX); +Serial IMU(p28, p27); // tx, rx + +char IMU_message[256]; + +void callback() { + // Note: you need to actually read from the serial to clear the RX interrupt + pc.putc(IMU.getc()); + led2 = !led2; +} int main() { - device.baud(57600); - - while(1) { - - //if(device.readable()) { - device.gets(buf, 256); - pc.printf("%s\n", buf); - // } - + IMU.baud(57600); + IMU.attach(&callback); - - - - - - - - + while (1) { + led1 = !led1; + wait(0.5); } } \ No newline at end of file