GPS to Pulga

Dependencies:   Si1133 BME280

Committer:
pancotinho
Date:
Fri Oct 23 14:42:31 2020 +0000
Revision:
25:ecdee9ef9939
Parent:
24:595155aa83c3
Child:
26:1e1776201716
Pulga com GPS;

Who changed what in which revision?

UserRevisionLine numberNew 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);
pancotinho 23:7f1c9c1a4c57 17
pancotinho 25:ecdee9ef9939 18 //Includes
pancotinho 24:595155aa83c3 19 #include "gps.txt"
pancotinho 23:7f1c9c1a4c57 20
pancotinho 24:595155aa83c3 21 void GPS_Read(void)
pancotinho 24:595155aa83c3 22 {
pancotinho 24:595155aa83c3 23 gps_print_local();
pancotinho 24:595155aa83c3 24 printf ("gps longitude=%d \n",lon);
pancotinho 24:595155aa83c3 25 printf ("gps latitude=%d \n",lat);
pancotinho 25:ecdee9ef9939 26 if(lat!=0 && lon!=0){
pancotinho 24:595155aa83c3 27 longitude=lon;
pancotinho 24:595155aa83c3 28 latitude=lat;
pancotinho 25:ecdee9ef9939 29 led1 = !led1;
pancotinho 25:ecdee9ef9939 30 }
pancotinho 24:595155aa83c3 31 }
pancotinho 25:ecdee9ef9939 32 int main() {
pancotinho 24:595155aa83c3 33
pancotinho 25:ecdee9ef9939 34 gps_config();
pancotinho 25:ecdee9ef9939 35 gps_leBootMsg();
pancotinho 25:ecdee9ef9939 36 gps_config_gnss ();
pancotinho 25:ecdee9ef9939 37
pancotinho 25:ecdee9ef9939 38 while (1){
pancotinho 25:ecdee9ef9939 39 GPS_Read();
pancotinho 25:ecdee9ef9939 40 wait (5);
pancotinho 24:595155aa83c3 41 }
pancotinho 23:7f1c9c1a4c57 42 }