We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ae1a8ac commit 6417815Copy full SHA for 6417815
examples/GetLocation/GetLocation.ino
@@ -0,0 +1,25 @@
1
+#include "ArduinoCellular.h"
2
+
3
+ArduinoCellular cellular = ArduinoCellular();
4
5
+void setup(){
6
+ Serial.begin(115200);
7
+ while (!Serial);
8
+ cellular.setDebugStream(Serial);
9
+ cellular.begin();
10
11
+ if(!cellular.enableGPS()){
12
+ Serial.println("Failed to enable GPS");
13
+ while(true); // Stop the program
14
+ }
15
+ delay(2000); // Give the modem some time to initialize
16
+}
17
18
+void loop(){
19
+ Location location = cellular.getGPSLocation();
20
+ Serial.println("GPS Location:");
21
+ Serial.print("* Latitude: "); Serial.println(location.latitude, 6);
22
+ Serial.print("* Longitude: "); Serial.println(location.longitude, 6);
23
+ Serial.println("--------------------\n");
24
+ delay(10000);
25
0 commit comments