-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNormal_GPS_Code.c
More file actions
35 lines (33 loc) · 1018 Bytes
/
Normal_GPS_Code.c
File metadata and controls
35 lines (33 loc) · 1018 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "mbed.h"
#include "GPS.h"
Serial pc(SERIAL_TX, SERIAL_RX);
GPS ark(PA_9, PA_10);
DigitalOut myled(LED1);
Serial device(PC_10, PC_11); // tx, rx
int main()
{
device.printf("AT+CWMODE=1\n\r");
wait(0.3);
device.printf("AT+CWJAP=\"L903\",\"laya2907\"\n\r");
wait(0.3);
device.printf("AT+CIPMUX=0\n\r");
wait(0.3);
device.printf("AT+CIPSTART=\"TCP\",\"184.106.153.149\",80\r\n");
wait(0.3);
while(1) {
if( ark.sample() == 1) {
myled=0;
float latitude = ark.latitude;
float longitude = ark.longitude;
float utc = ark.utc+50000;
pc.printf("latitude: %0.2f, longitude: %0.2f, utc: %f\r\n",latitude,longitude,utc);
device.printf("AT+CIPSEND=49\r\n");
wait(0.3);
device.printf("GET /update?key=UQECY67419G56BNR&field1=%.2f\r\n",longitude);
wait(0.3);
wait(1);
} else {
myled=1;
}
}
}