configuration du GPS via le Mbed

Dependencies:   mbed

Committer:
belloula
Date:
Tue Mar 06 11:02:35 2012 +0000
Revision:
0:56f6f307dbb2

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
belloula 0:56f6f307dbb2 1 #include "mbed.h"
belloula 0:56f6f307dbb2 2 //Connect IMU to pc via Xbee to calibrate IMU via "AHRSInterfacex86" soft
belloula 0:56f6f307dbb2 3
belloula 0:56f6f307dbb2 4 Serial pc(USBTX, USBRX);
belloula 0:56f6f307dbb2 5 DigitalOut myled(LED1);
belloula 0:56f6f307dbb2 6
belloula 0:56f6f307dbb2 7 DigitalOut EnableGPS(p12);
belloula 0:56f6f307dbb2 8 Serial gps(p13, p14);
belloula 0:56f6f307dbb2 9
belloula 0:56f6f307dbb2 10 void fpc() {
belloula 0:56f6f307dbb2 11 while (pc.readable()) {
belloula 0:56f6f307dbb2 12 gps.putc(pc.getc());
belloula 0:56f6f307dbb2 13 }
belloula 0:56f6f307dbb2 14 }
belloula 0:56f6f307dbb2 15
belloula 0:56f6f307dbb2 16 void fgps() {
belloula 0:56f6f307dbb2 17 while (gps.readable()) {
belloula 0:56f6f307dbb2 18 pc.putc(gps.getc());
belloula 0:56f6f307dbb2 19 }
belloula 0:56f6f307dbb2 20 }
belloula 0:56f6f307dbb2 21
belloula 0:56f6f307dbb2 22 int main() {
belloula 0:56f6f307dbb2 23 pc.baud(38400);
belloula 0:56f6f307dbb2 24 gps.baud(38400);
belloula 0:56f6f307dbb2 25
belloula 0:56f6f307dbb2 26 gps.attach(fgps);
belloula 0:56f6f307dbb2 27 pc.attach(fpc);
belloula 0:56f6f307dbb2 28 //reset xbee module
belloula 0:56f6f307dbb2 29 EnableGPS=0;
belloula 0:56f6f307dbb2 30 wait(1);
belloula 0:56f6f307dbb2 31 EnableGPS=1;
belloula 0:56f6f307dbb2 32
belloula 0:56f6f307dbb2 33
belloula 0:56f6f307dbb2 34 while (1)
belloula 0:56f6f307dbb2 35
belloula 0:56f6f307dbb2 36 {
belloula 0:56f6f307dbb2 37 myled = 0;
belloula 0:56f6f307dbb2 38 wait_ms(500);
belloula 0:56f6f307dbb2 39 myled = 1;
belloula 0:56f6f307dbb2 40 wait_ms(500);
belloula 0:56f6f307dbb2 41 }
belloula 0:56f6f307dbb2 42 }