Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of GPS_HelloWorld by
main.cpp@1:b54625426fa1, 2014-11-21 (annotated)
- Committer:
- Renato
- Date:
- Fri Nov 21 17:01:28 2014 +0000
- Revision:
- 1:b54625426fa1
- Parent:
- 0:6b7345059afe
- Child:
- 2:7aabbc496ce1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
simon | 0:6b7345059afe | 1 | #include "mbed.h" |
simon | 0:6b7345059afe | 2 | #include "GPS.h" |
simon | 0:6b7345059afe | 3 | |
simon | 0:6b7345059afe | 4 | Serial pc(USBTX, USBRX); |
simon | 0:6b7345059afe | 5 | GPS gps(p9, p10); |
simon | 0:6b7345059afe | 6 | |
simon | 0:6b7345059afe | 7 | int main() { |
simon | 0:6b7345059afe | 8 | while(1) { |
simon | 0:6b7345059afe | 9 | if(gps.sample()) { |
Renato | 1:b54625426fa1 | 10 | pc.printf("\nI'm at %f, %f\n", gps.longitude, gps.latitude); |
Renato | 1:b54625426fa1 | 11 | pc.printf("Current time is %.0f\n", gps.curr_time); |
Renato | 1:b54625426fa1 | 12 | pc.printf("Current altitude is %.1f meters\n", gps.altitude); |
Renato | 1:b54625426fa1 | 13 | pc.printf("Satellites in view %d\n", gps.number_sats); |
Renato | 1:b54625426fa1 | 14 | pc.printf("Current precision is %.1f meters\n", gps.HDOP); |
Renato | 1:b54625426fa1 | 15 | wait(5); |
simon | 0:6b7345059afe | 16 | } else { |
simon | 0:6b7345059afe | 17 | pc.printf("Oh Dear! No lock :(\n"); |
simon | 0:6b7345059afe | 18 | } |
simon | 0:6b7345059afe | 19 | } |
simon | 0:6b7345059afe | 20 | } |