@@ -30,6 +30,8 @@ UM980 myGNSS;
30
30
31
31
HardwareSerial SerialGNSS (1 ); // Use UART1 on the ESP32
32
32
33
+ unsigned long lastCheck = 0 ;
34
+
33
35
void setup ()
34
36
{
35
37
Serial.begin (115200 );
@@ -49,9 +51,9 @@ void setup()
49
51
}
50
52
Serial.println (" UM980 detected!" );
51
53
52
- while (Serial.available ()) Serial.read (); // Clear RX buffer
54
+ while (Serial.available ()) Serial.read (); // Clear RX buffer
53
55
Serial.println (" Press any key to factory reset the UM980" );
54
- while (Serial.available () == 0 ) delay (1 ); // Wait for user to press a button
56
+ while (Serial.available () == 0 ) delay (1 ); // Wait for user to press a button
55
57
56
58
// Clear saved configurations, satellite ephemerides, position information, and reset baud rate to 115200bps.
57
59
if (myGNSS.factoryReset () == true )
@@ -70,7 +72,6 @@ void setup()
70
72
71
73
Serial.println (" UM980 has completed reset" );
72
74
73
-
74
75
// Resetting the receiver will clear the satellite ephemerides, position information, satellite
75
76
// almanacs, ionosphere parameters and UTC parameters saved in the receiver.
76
77
// myGNSS.reset();
@@ -84,5 +85,61 @@ void setup()
84
85
85
86
void loop ()
86
87
{
87
- // Do nothing
88
- }
88
+ myGNSS.update (); // Regularly call to parse any new data
89
+
90
+ if (millis () - lastCheck > 1000 )
91
+ {
92
+ lastCheck = millis ();
93
+
94
+ // The get methods are updated whenever new data is parsed with the update() call.
95
+ // By default, this data is updated once per second.
96
+
97
+ Serial.print (" Lat/Long/Alt: " );
98
+ Serial.print (myGNSS.getLatitude (), 11 );
99
+ Serial.print (" /" );
100
+ Serial.print (myGNSS.getLongitude (), 11 );
101
+ Serial.print (" /" );
102
+ Serial.print (myGNSS.getAltitude (), 4 );
103
+ Serial.println ();
104
+
105
+ Serial.print (" Horizontal Speed: " );
106
+ Serial.print (myGNSS.getHorizontalSpeed ());
107
+ Serial.print (" m/s Vertical Speed: " );
108
+ Serial.print (myGNSS.getVerticalSpeed ());
109
+ Serial.print (" m/s Direction from North: " );
110
+ Serial.print (myGNSS.getTrackGround ());
111
+ Serial.print (" (degrees)" );
112
+ Serial.println ();
113
+
114
+ Serial.print (" Date (yyyy/mm/dd): " );
115
+ Serial.print (myGNSS.getYear ());
116
+ Serial.print (" /" );
117
+ if (myGNSS.getMonth () < 10 )
118
+ Serial.print (" 0" );
119
+ Serial.print (myGNSS.getMonth ());
120
+ Serial.print (" /" );
121
+ if (myGNSS.getDay () < 10 )
122
+ Serial.print (" 0" );
123
+ Serial.print (myGNSS.getDay ());
124
+
125
+ Serial.print (" Time (hh:mm:dd): " );
126
+ if (myGNSS.getHour () < 10 )
127
+ Serial.print (" 0" );
128
+ Serial.print (myGNSS.getHour ());
129
+ Serial.print (" :" );
130
+ if (myGNSS.getMinute () < 10 )
131
+ Serial.print (" 0" );
132
+ Serial.print (myGNSS.getMinute ());
133
+ Serial.print (" :" );
134
+ if (myGNSS.getSecond () < 10 )
135
+ Serial.print (" 0" );
136
+ Serial.print (myGNSS.getSecond ());
137
+ Serial.println ();
138
+
139
+ Serial.print (" Satellites in view: " );
140
+ Serial.print (myGNSS.getSIV ());
141
+ Serial.println ();
142
+
143
+ Serial.println ();
144
+ }
145
+ }
0 commit comments