Adafruit GPS , distance and count footsteps
Dependencies: mbed SDFileSystem MBed_Adafruit-GPS-Library USBDevice
Diff: main.cpp
- Revision:
- 4:e87d9fbc4869
- Parent:
- 3:e38a115af1dd
- Child:
- 5:da8e5af9d44b
diff -r e38a115af1dd -r e87d9fbc4869 main.cpp --- a/main.cpp Thu Dec 22 05:59:15 2016 +0000 +++ b/main.cpp Wed Dec 18 07:44:26 2019 +0000 @@ -1,18 +1,17 @@ -//gps.cpp -//for use with Adafruit Ultimate GPS -//Reads in and parses GPS data #include "mbed.h" #include "MBed_Adafruit_GPS.h" +#include "USBSerial.h" +USBSerial pc; Serial * gps_Serial; -Serial pc (USBTX, USBRX); + int main() { - pc.baud(115200); //sets virtual COM serial communication to high rate; this is to allow more time to be spent on GPS retrieval + //pc.baud(115200); //sets virtual COM serial communication to high rate; this is to allow more time to be spent on GPS retrieval - gps_Serial = new Serial(PTC17,PTC16); //serial object for use w/ GPS + gps_Serial = new Serial(PA_2,PA_3); //serial object for use w/ GPS Adafruit_GPS myGPS(gps_Serial); //object of Adafruit's GPS class char c; //when read via Adafruit_GPS::read(), the class returns single character stored here Timer refresh_Timer; //sets up a timer for use in loop; how often do we print GPS info? @@ -34,7 +33,7 @@ while(true){ c = myGPS.read(); //queries the GPS - if (c) { pc.printf("%c", c); } //this line will echo the GPS data if not paused + if (c) { } //this line will echo the GPS data if not paused //check if we recieved a new message from GPS, if so, attempt to parse it, if ( myGPS.newNMEAreceived() ) {