Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

Commit 00852c1

Browse files
committed
Update Example17_Geofence.ino
1 parent a920bd8 commit 00852c1

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

examples/Example17_Geofence/Example17_Geofence.ino

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ void setup()
5050
Serial.println();
5151

5252
delay(1000); // Let the GPS power up
53-
53+
5454
if (myGPS.begin() == false) //Connect to the Ublox module using Wire port
5555
{
5656
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
@@ -64,7 +64,7 @@ void setup()
6464

6565
byte fixType = 0;
6666

67-
while (fixType != 3)
67+
while (fixType < 3)
6868
{
6969
fixType = myGPS.getFixType(); // Get the fix type
7070
Serial.print(F("Fix: ")); // Print it
@@ -74,6 +74,7 @@ void setup()
7474
else if(fixType == 2) Serial.print(F(" = 2D"));
7575
else if(fixType == 3) Serial.print(F(" = 3D"));
7676
else if(fixType == 4) Serial.print(F(" = GNSS + Dead reckoning"));
77+
else if(fixType == 5) Serial.print(F(" = Time only"));
7778
Serial.println();
7879
delay(1000);
7980
}
@@ -89,7 +90,7 @@ void setup()
8990
Serial.println(longitude);
9091

9192
uint32_t radius = 500; // Set the radius to 5m (radius is in m * 10^-2 i.e. cm)
92-
93+
9394
byte confidence = 2; // Set the confidence level: 0=none, 1=68%, 2=95%, 3=99.7%, 4=99.99%
9495

9596
// Call clearGeofences() to clear all existing geofences.
@@ -99,18 +100,18 @@ void setup()
99100
// It is possible to define up to four geofences.
100101
// Call addGeofence up to four times to define them.
101102
Serial.println(F("Setting the geofences:"));
102-
103+
103104
Serial.print(F("addGeofence for geofence 1 returned: "));
104105
Serial.println(myGPS.addGeofence(latitude, longitude, radius, confidence));
105-
106+
106107
radius = 1000; // 10m
107108
Serial.print(F("addGeofence for geofence 2 returned: "));
108109
Serial.println(myGPS.addGeofence(latitude, longitude, radius, confidence));
109-
110+
110111
radius = 1500; // 15m
111112
Serial.print(F("addGeofence for geofence 3 returned: "));
112113
Serial.println(myGPS.addGeofence(latitude, longitude, radius, confidence));
113-
114+
114115
radius = 2000; // 20m
115116
Serial.print(F("addGeofence for geofence 4 returned: "));
116117
Serial.println(myGPS.addGeofence(latitude, longitude, radius, confidence));
@@ -130,16 +131,16 @@ void loop()
130131
Serial.println(F(".")); // Tidy up
131132
return; // and go round the loop again
132133
}
133-
134+
134135
Serial.print(F(". status is: ")); // Print the status
135136
Serial.print(currentGeofenceState.status);
136-
137+
137138
Serial.print(F(". numFences is: ")); // Print the numFences
138139
Serial.print(currentGeofenceState.numFences);
139-
140+
140141
Serial.print(F(". combState is: ")); // Print the combined state
141142
Serial.print(currentGeofenceState.combState);
142-
143+
143144
if (currentGeofenceState.combState == 0)
144145
{
145146
Serial.print(F(" = Unknown"));
@@ -163,6 +164,6 @@ void loop()
163164
Serial.print(currentGeofenceState.states[i]);
164165
}
165166
Serial.println();
166-
167+
167168
delay(1000);
168169
}

0 commit comments

Comments
 (0)