GPS and IMU reading works

Dependencies:   mbed Servo SDFileSystem

/media/uploads/taoqiuyang/img_2352.jpg

main.cpp

Committer:
taoqiuyang
Date:
2015-08-08
Revision:
2:afb333543af5
Parent:
1:e7245ffb4820
Child:
3:ab9f94d112c0

File content as of revision 2:afb333543af5:

#include "mbed.h"
 
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() {
    IMU.baud(57600);
    IMU.attach(&callback);
    
    while (1) {
        led1 = !led1;
        wait(0.5);
    }
}