Skip to content

Commit 2a2e2f6

Browse files
committed
Extract time into its own example
1 parent 6417815 commit 2a2e2f6

File tree

3 files changed

+28
-40
lines changed

3 files changed

+28
-40
lines changed

Diff for: examples/GetTime/GetTime.ino

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#include "ArduinoCellular.h"
2+
3+
ArduinoCellular cellular = ArduinoCellular();
4+
5+
void setup(){
6+
Serial.begin(115200);
7+
while (!Serial);
8+
cellular.begin();
9+
10+
if(!cellular.enableGPS()){
11+
Serial.println("Failed to enable GPS");
12+
while(true); // Stop the program
13+
}
14+
delay(2000); // Give the modem some time to initialize
15+
}
16+
17+
void loop(){
18+
Location location = cellular.getGPSLocation(10000);
19+
20+
if(location.latitude == 0.0 && location.longitude == 0.0){
21+
Serial.println("Failed to get GPS location");
22+
} else {
23+
Time time = cellular.getGPSTime();
24+
Serial.print("Current time (ISO8601): "); Serial.println(time.getISO8601());
25+
}
26+
27+
delay(10000);
28+
}

Diff for: examples/TimeAndLocation/TimeAndLocation.ino

-36
This file was deleted.

Diff for: examples/TimeAndLocation/arduino_secrets.h

-4
This file was deleted.

0 commit comments

Comments
 (0)