Example to go with my modified GPS library
Fork of GPS_HelloWorld by
main.cpp@1:bf6b98a2e480, 2013-11-02 (annotated)
- Committer:
- 8fromPi
- Date:
- Sat Nov 02 16:27:23 2013 +0000
- Revision:
- 1:bf6b98a2e480
- Parent:
- 0:6b7345059afe
Example to go with GPS library
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
8fromPi | 1:bf6b98a2e480 | 1 | /* Example showing how to hook up to different GPS modules (GlobalSat EM406a and Adafruit Ultimate GPSv3) |
8fromPi | 1:bf6b98a2e480 | 2 | * to emulated serial ports at different speeds */ |
simon | 0:6b7345059afe | 3 | #include "mbed.h" |
simon | 0:6b7345059afe | 4 | #include "GPS.h" |
simon | 0:6b7345059afe | 5 | |
8fromPi | 1:bf6b98a2e480 | 6 | GPS gpsSpark(P0_4, P0_0, 4800); |
8fromPi | 1:bf6b98a2e480 | 7 | GPS gpsAda(P0_12, P0_15, 9600); |
8fromPi | 1:bf6b98a2e480 | 8 | |
simon | 0:6b7345059afe | 9 | Serial pc(USBTX, USBRX); |
simon | 0:6b7345059afe | 10 | |
simon | 0:6b7345059afe | 11 | int main() { |
8fromPi | 1:bf6b98a2e480 | 12 | while (1) { |
8fromPi | 1:bf6b98a2e480 | 13 | |
8fromPi | 1:bf6b98a2e480 | 14 | if(gpsSpark.sample()) { |
8fromPi | 1:bf6b98a2e480 | 15 | pc.printf("set %d\t%c\t%f\t%f\t%f\t%f\t%f\n\r", takes, 'Sparkfun Breakout', gpsSpark.longitude, gpsSpark.latitude, gpsSpark.alt, gpsSpark.geoid, gpsSpark.time); |
8fromPi | 1:bf6b98a2e480 | 16 | } |
8fromPi | 1:bf6b98a2e480 | 17 | |
8fromPi | 1:bf6b98a2e480 | 18 | if(gpsAda.sample()) { |
8fromPi | 1:bf6b98a2e480 | 19 | pc.printf("set %d\t%c\t%f\t%f\t%f\t%f\t%f\n\r", takes, 'Adafruit', gpsAda.longitude, gpsAda.latitude, gpsAda.alt, gpsAda.geoid, gpsAda.time); |
simon | 0:6b7345059afe | 20 | } |
8fromPi | 1:bf6b98a2e480 | 21 | |
simon | 0:6b7345059afe | 22 | } |
8fromPi | 1:bf6b98a2e480 | 23 | |
8fromPi | 1:bf6b98a2e480 | 24 | } |