File tree Expand file tree Collapse file tree 3 files changed +28
-40
lines changed
Expand file tree Collapse file tree 3 files changed +28
-40
lines changed Original file line number Diff line number Diff line change 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+ }
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments