GPS to Pulga
source/main.cpp@26:1e1776201716, 2020-12-11 (annotated)
- Committer:
- brunnobbco
- Date:
- Fri Dec 11 18:59:00 2020 +0000
- Revision:
- 26:1e1776201716
- Parent:
- 25:ecdee9ef9939
Pulga_GPS
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pancotinho | 23:7f1c9c1a4c57 | 1 | /***GENERAL INCLUDES***/ |
pancotinho | 23:7f1c9c1a4c57 | 2 | |
pancotinho | 23:7f1c9c1a4c57 | 3 | //MBed Includes |
pancotinho | 23:7f1c9c1a4c57 | 4 | |
pancotinho | 23:7f1c9c1a4c57 | 5 | #include <events/mbed_events.h> |
pancotinho | 23:7f1c9c1a4c57 | 6 | #include <stdio.h> |
pancotinho | 23:7f1c9c1a4c57 | 7 | #include "mbed.h" |
pancotinho | 23:7f1c9c1a4c57 | 8 | |
pancotinho | 23:7f1c9c1a4c57 | 9 | |
pancotinho | 24:595155aa83c3 | 10 | |
pancotinho | 25:ecdee9ef9939 | 11 | //Global Variables |
pancotinho | 24:595155aa83c3 | 12 | int lat=0; |
pancotinho | 24:595155aa83c3 | 13 | int lon=0; |
pancotinho | 24:595155aa83c3 | 14 | int latitude=0; |
pancotinho | 24:595155aa83c3 | 15 | int longitude=0; |
pancotinho | 25:ecdee9ef9939 | 16 | DigitalOut led1(P1_13); |
brunnobbco | 26:1e1776201716 | 17 | DigitalOut led2(P1_14); |
pancotinho | 23:7f1c9c1a4c57 | 18 | |
pancotinho | 25:ecdee9ef9939 | 19 | //Includes |
pancotinho | 24:595155aa83c3 | 20 | #include "gps.txt" |
pancotinho | 23:7f1c9c1a4c57 | 21 | |
pancotinho | 24:595155aa83c3 | 22 | void GPS_Read(void) |
pancotinho | 24:595155aa83c3 | 23 | { |
pancotinho | 24:595155aa83c3 | 24 | gps_print_local(); |
pancotinho | 24:595155aa83c3 | 25 | printf ("gps longitude=%d \n",lon); |
pancotinho | 24:595155aa83c3 | 26 | printf ("gps latitude=%d \n",lat); |
pancotinho | 25:ecdee9ef9939 | 27 | if(lat!=0 && lon!=0){ |
pancotinho | 24:595155aa83c3 | 28 | longitude=lon; |
pancotinho | 24:595155aa83c3 | 29 | latitude=lat; |
pancotinho | 25:ecdee9ef9939 | 30 | led1 = !led1; |
pancotinho | 25:ecdee9ef9939 | 31 | } |
pancotinho | 24:595155aa83c3 | 32 | } |
pancotinho | 25:ecdee9ef9939 | 33 | int main() { |
pancotinho | 24:595155aa83c3 | 34 | |
brunnobbco | 26:1e1776201716 | 35 | led2=0; |
pancotinho | 25:ecdee9ef9939 | 36 | gps_config(); |
pancotinho | 25:ecdee9ef9939 | 37 | gps_leBootMsg(); |
pancotinho | 25:ecdee9ef9939 | 38 | gps_config_gnss (); |
pancotinho | 25:ecdee9ef9939 | 39 | |
pancotinho | 25:ecdee9ef9939 | 40 | while (1){ |
pancotinho | 25:ecdee9ef9939 | 41 | GPS_Read(); |
pancotinho | 25:ecdee9ef9939 | 42 | wait (5); |
pancotinho | 24:595155aa83c3 | 43 | } |
pancotinho | 23:7f1c9c1a4c57 | 44 | } |