@@ -50,7 +50,7 @@ void setup()
50
50
Serial.println ();
51
51
52
52
delay (1000 ); // Let the GPS power up
53
-
53
+
54
54
if (myGPS.begin () == false ) // Connect to the Ublox module using Wire port
55
55
{
56
56
Serial.println (F (" Ublox GPS not detected at default I2C address. Please check wiring. Freezing." ));
@@ -64,7 +64,7 @@ void setup()
64
64
65
65
byte fixType = 0 ;
66
66
67
- while (fixType != 3 )
67
+ while (fixType < 3 )
68
68
{
69
69
fixType = myGPS.getFixType (); // Get the fix type
70
70
Serial.print (F (" Fix: " )); // Print it
@@ -74,6 +74,7 @@ void setup()
74
74
else if (fixType == 2 ) Serial.print (F (" = 2D" ));
75
75
else if (fixType == 3 ) Serial.print (F (" = 3D" ));
76
76
else if (fixType == 4 ) Serial.print (F (" = GNSS + Dead reckoning" ));
77
+ else if (fixType == 5 ) Serial.print (F (" = Time only" ));
77
78
Serial.println ();
78
79
delay (1000 );
79
80
}
@@ -89,7 +90,7 @@ void setup()
89
90
Serial.println (longitude);
90
91
91
92
uint32_t radius = 500 ; // Set the radius to 5m (radius is in m * 10^-2 i.e. cm)
92
-
93
+
93
94
byte confidence = 2 ; // Set the confidence level: 0=none, 1=68%, 2=95%, 3=99.7%, 4=99.99%
94
95
95
96
// Call clearGeofences() to clear all existing geofences.
@@ -99,18 +100,18 @@ void setup()
99
100
// It is possible to define up to four geofences.
100
101
// Call addGeofence up to four times to define them.
101
102
Serial.println (F (" Setting the geofences:" ));
102
-
103
+
103
104
Serial.print (F (" addGeofence for geofence 1 returned: " ));
104
105
Serial.println (myGPS.addGeofence (latitude, longitude, radius, confidence));
105
-
106
+
106
107
radius = 1000 ; // 10m
107
108
Serial.print (F (" addGeofence for geofence 2 returned: " ));
108
109
Serial.println (myGPS.addGeofence (latitude, longitude, radius, confidence));
109
-
110
+
110
111
radius = 1500 ; // 15m
111
112
Serial.print (F (" addGeofence for geofence 3 returned: " ));
112
113
Serial.println (myGPS.addGeofence (latitude, longitude, radius, confidence));
113
-
114
+
114
115
radius = 2000 ; // 20m
115
116
Serial.print (F (" addGeofence for geofence 4 returned: " ));
116
117
Serial.println (myGPS.addGeofence (latitude, longitude, radius, confidence));
@@ -130,16 +131,16 @@ void loop()
130
131
Serial.println (F (" ." )); // Tidy up
131
132
return ; // and go round the loop again
132
133
}
133
-
134
+
134
135
Serial.print (F (" . status is: " )); // Print the status
135
136
Serial.print (currentGeofenceState.status );
136
-
137
+
137
138
Serial.print (F (" . numFences is: " )); // Print the numFences
138
139
Serial.print (currentGeofenceState.numFences );
139
-
140
+
140
141
Serial.print (F (" . combState is: " )); // Print the combined state
141
142
Serial.print (currentGeofenceState.combState );
142
-
143
+
143
144
if (currentGeofenceState.combState == 0 )
144
145
{
145
146
Serial.print (F (" = Unknown" ));
@@ -163,6 +164,6 @@ void loop()
163
164
Serial.print (currentGeofenceState.states [i]);
164
165
}
165
166
Serial.println ();
166
-
167
+
167
168
delay (1000 );
168
169
}
0 commit comments