gps nmea sample program
Dependencies: mbed
Fork of GPS by
main.cpp@1:8de9bf0961a0, 2017-02-14 (annotated)
- Committer:
- superphil06
- Date:
- Tue Feb 14 07:35:23 2017 +0000
- Revision:
- 1:8de9bf0961a0
gps nmea sample progam
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
superphil06 | 1:8de9bf0961a0 | 1 | #include "mbed.h" |
superphil06 | 1:8de9bf0961a0 | 2 | #include "GPS.h" |
superphil06 | 1:8de9bf0961a0 | 3 | |
superphil06 | 1:8de9bf0961a0 | 4 | Serial pc(USBTX, USBRX); |
superphil06 | 1:8de9bf0961a0 | 5 | GPS gps(p9, p10); |
superphil06 | 1:8de9bf0961a0 | 6 | |
superphil06 | 1:8de9bf0961a0 | 7 | int main() { |
superphil06 | 1:8de9bf0961a0 | 8 | while(1) { |
superphil06 | 1:8de9bf0961a0 | 9 | if(gps.sample()) { |
superphil06 | 1:8de9bf0961a0 | 10 | pc.printf("I'm at %f, %f\n", gps.longitude, gps.latitude); |
superphil06 | 1:8de9bf0961a0 | 11 | } else { |
superphil06 | 1:8de9bf0961a0 | 12 | pc.printf("Oh Dear! No lock :(\n"); |
superphil06 | 1:8de9bf0961a0 | 13 | } |
superphil06 | 1:8de9bf0961a0 | 14 | } |
superphil06 | 1:8de9bf0961a0 | 15 | } |