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@2:7aabbc496ce1, 2014-11-26 (annotated)
- Committer:
- Renato
- Date:
- Wed Nov 26 14:40:22 2014 +0000
- Revision:
- 2:7aabbc496ce1
- Parent:
- 1:b54625426fa1
vector com data
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 | |
| Renato | 2:7aabbc496ce1 | 7 | char timer[6]; |
| Renato | 2:7aabbc496ce1 | 8 | int i, hora; |
| Renato | 2:7aabbc496ce1 | 9 | |
| simon | 0:6b7345059afe | 10 | int main() { |
| simon | 0:6b7345059afe | 11 | while(1) { |
| simon | 0:6b7345059afe | 12 | if(gps.sample()) { |
| Renato | 2:7aabbc496ce1 | 13 | |
| Renato | 1:b54625426fa1 | 14 | pc.printf("\nI'm at %f, %f\n", gps.longitude, gps.latitude); |
| Renato | 1:b54625426fa1 | 15 | pc.printf("Current time is %.0f\n", gps.curr_time); |
| Renato | 1:b54625426fa1 | 16 | pc.printf("Current altitude is %.1f meters\n", gps.altitude); |
| Renato | 1:b54625426fa1 | 17 | pc.printf("Satellites in view %d\n", gps.number_sats); |
| Renato | 1:b54625426fa1 | 18 | pc.printf("Current precision is %.1f meters\n", gps.HDOP); |
| Renato | 2:7aabbc496ce1 | 19 | |
| Renato | 2:7aabbc496ce1 | 20 | hora = gps.curr_time; |
| Renato | 2:7aabbc496ce1 | 21 | sprintf(timer,"%d",hora); |
| Renato | 2:7aabbc496ce1 | 22 | for(i=0;i<strlen(timer);i++) |
| Renato | 2:7aabbc496ce1 | 23 | pc.printf("%c",timer[i]); |
| Renato | 2:7aabbc496ce1 | 24 | |
| Renato | 2:7aabbc496ce1 | 25 | |
| Renato | 1:b54625426fa1 | 26 | wait(5); |
| simon | 0:6b7345059afe | 27 | } else { |
| simon | 0:6b7345059afe | 28 | pc.printf("Oh Dear! No lock :(\n"); |
| simon | 0:6b7345059afe | 29 | } |
| simon | 0:6b7345059afe | 30 | } |
| simon | 0:6b7345059afe | 31 | } |
