Quang Anh Le
/
GPS_helloworld
n.n
main.cpp@0:19357c8e66e0, 2019-08-05 (annotated)
- Committer:
- QuangAnhLe
- Date:
- Mon Aug 05 17:51:59 2019 +0000
- Revision:
- 0:19357c8e66e0
1.commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
QuangAnhLe | 0:19357c8e66e0 | 1 | #include "mbed.h" |
QuangAnhLe | 0:19357c8e66e0 | 2 | #include "GPS.h" |
QuangAnhLe | 0:19357c8e66e0 | 3 | #include <iostream> |
QuangAnhLe | 0:19357c8e66e0 | 4 | #include <sstream> |
QuangAnhLe | 0:19357c8e66e0 | 5 | #include <bitset> |
QuangAnhLe | 0:19357c8e66e0 | 6 | |
QuangAnhLe | 0:19357c8e66e0 | 7 | Serial pc(PA_2,PA_3); |
QuangAnhLe | 0:19357c8e66e0 | 8 | GPS gps (PA_9 ,PA_10); |
QuangAnhLe | 0:19357c8e66e0 | 9 | |
QuangAnhLe | 0:19357c8e66e0 | 10 | |
QuangAnhLe | 0:19357c8e66e0 | 11 | // output |
QuangAnhLe | 0:19357c8e66e0 | 12 | void TraceInt(int param) |
QuangAnhLe | 0:19357c8e66e0 | 13 | { |
QuangAnhLe | 0:19357c8e66e0 | 14 | pc.printf("%d\r\n",param); |
QuangAnhLe | 0:19357c8e66e0 | 15 | } |
QuangAnhLe | 0:19357c8e66e0 | 16 | |
QuangAnhLe | 0:19357c8e66e0 | 17 | int main() { |
QuangAnhLe | 0:19357c8e66e0 | 18 | pc.printf("Searching..."); |
QuangAnhLe | 0:19357c8e66e0 | 19 | int i = 0; |
QuangAnhLe | 0:19357c8e66e0 | 20 | pc.baud(9600); |
QuangAnhLe | 0:19357c8e66e0 | 21 | |
QuangAnhLe | 0:19357c8e66e0 | 22 | while(1) { |
QuangAnhLe | 0:19357c8e66e0 | 23 | |
QuangAnhLe | 0:19357c8e66e0 | 24 | TraceInt(i++); |
QuangAnhLe | 0:19357c8e66e0 | 25 | wait(1); |
QuangAnhLe | 0:19357c8e66e0 | 26 | /*if(gps.sample()){ |
QuangAnhLe | 0:19357c8e66e0 | 27 | float latitude = gps.latitude; |
QuangAnhLe | 0:19357c8e66e0 | 28 | float longitude = gps.longitude; |
QuangAnhLe | 0:19357c8e66e0 | 29 | float utc = gps.utc + 50000; |
QuangAnhLe | 0:19357c8e66e0 | 30 | pc.printf("latitude: %0.2f, longitude: %0.2f, utc: %f\r\n",latitude,longitude,utc); |
QuangAnhLe | 0:19357c8e66e0 | 31 | pc.printf("Lock Found!!!!"); |
QuangAnhLe | 0:19357c8e66e0 | 32 | wait(1); |
QuangAnhLe | 0:19357c8e66e0 | 33 | } |
QuangAnhLe | 0:19357c8e66e0 | 34 | else{ |
QuangAnhLe | 0:19357c8e66e0 | 35 | pc.printf("No Lock Found!!!!"); |
QuangAnhLe | 0:19357c8e66e0 | 36 | wait(1); |
QuangAnhLe | 0:19357c8e66e0 | 37 | }*/ |
QuangAnhLe | 0:19357c8e66e0 | 38 | |
QuangAnhLe | 0:19357c8e66e0 | 39 | } |
QuangAnhLe | 0:19357c8e66e0 | 40 | } |