Adafruit GPS library sample with Xadow GPS and Xadow Oled
Dependencies: MBed_Adafruit-GPS-Library SSD1308_128x64_I2C USBDevice mbed
Fork of AVC_gps by
main.cpp@0:59cfe30c337c, 2014-10-09 (annotated)
- Committer:
- gerardo_carmona
- Date:
- Thu Oct 09 17:11:51 2014 +0000
- Revision:
- 0:59cfe30c337c
- Child:
- 1:2387ce3e58c8
GPS first test, just extracting the nmea sentences
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gerardo_carmona | 0:59cfe30c337c | 1 | #include "mbed.h" |
gerardo_carmona | 0:59cfe30c337c | 2 | |
gerardo_carmona | 0:59cfe30c337c | 3 | DigitalOut led(LED_GREEN); |
gerardo_carmona | 0:59cfe30c337c | 4 | Serial gps(PTC17, PTC16); |
gerardo_carmona | 0:59cfe30c337c | 5 | Serial pc(USBTX, USBRX); |
gerardo_carmona | 0:59cfe30c337c | 6 | |
gerardo_carmona | 0:59cfe30c337c | 7 | int main(){ |
gerardo_carmona | 0:59cfe30c337c | 8 | gps.baud(4800); |
gerardo_carmona | 0:59cfe30c337c | 9 | while (true) { |
gerardo_carmona | 0:59cfe30c337c | 10 | char str [200]; |
gerardo_carmona | 0:59cfe30c337c | 11 | char c; |
gerardo_carmona | 0:59cfe30c337c | 12 | if (gps.readable()){ |
gerardo_carmona | 0:59cfe30c337c | 13 | c = gps.getc(); |
gerardo_carmona | 0:59cfe30c337c | 14 | if (c == '$') { |
gerardo_carmona | 0:59cfe30c337c | 15 | gps.scanf ("%199s",str); |
gerardo_carmona | 0:59cfe30c337c | 16 | pc.printf("%s \n",str); |
gerardo_carmona | 0:59cfe30c337c | 17 | //while (n >= |
gerardo_carmona | 0:59cfe30c337c | 18 | } |
gerardo_carmona | 0:59cfe30c337c | 19 | }else{ |
gerardo_carmona | 0:59cfe30c337c | 20 | //pc.printf("No gps data \n"); |
gerardo_carmona | 0:59cfe30c337c | 21 | } |
gerardo_carmona | 0:59cfe30c337c | 22 | led = !led; // toggle led |
gerardo_carmona | 0:59cfe30c337c | 23 | //wait(0.001f); |
gerardo_carmona | 0:59cfe30c337c | 24 | } |
gerardo_carmona | 0:59cfe30c337c | 25 | } |