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

Commit b5b69c9

Browse files
committed
White space change to ex 15
1 parent e2ddf9e commit b5b69c9

File tree

1 file changed

+56
-56
lines changed

1 file changed

+56
-56
lines changed

examples/Example15_GetDateTime/Example15_GetDateTime.ino

+56-56
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
basically do whatever you want with this code.
88
99
This example shows how to query a Ublox module for the current time and date. We also
10-
turn off the NMEA output on the I2C port. This decreases the amount of I2C traffic
10+
turn off the NMEA output on the I2C port. This decreases the amount of I2C traffic
1111
dramatically.
1212
1313
Leave NMEA parsing behind. Now you can simply ask the module for the datums you want!
@@ -33,63 +33,63 @@ long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to Ublox m
3333

3434
void setup()
3535
{
36-
Serial.begin(115200);
37-
while (!Serial)
38-
; //Wait for user to open terminal
39-
Serial.println("SparkFun Ublox Example");
40-
41-
Wire.begin();
42-
43-
if (myGPS.begin() == false) //Connect to the Ublox module using Wire port
44-
{
45-
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
46-
while (1)
47-
;
48-
}
49-
50-
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
51-
myGPS.saveConfiguration(); //Save the current settings to flash and BBR
36+
Serial.begin(115200);
37+
while (!Serial)
38+
; //Wait for user to open terminal
39+
Serial.println("SparkFun Ublox Example");
40+
41+
Wire.begin();
42+
43+
if (myGPS.begin() == false) //Connect to the Ublox module using Wire port
44+
{
45+
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
46+
while (1)
47+
;
48+
}
49+
50+
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
51+
myGPS.saveConfiguration(); //Save the current settings to flash and BBR
5252
}
5353

5454
void loop()
5555
{
56-
//Query module only every second. Doing it more often will just cause I2C traffic.
57-
//The module only responds when a new position is available
58-
if (millis() - lastTime > 1000)
59-
{
60-
lastTime = millis(); //Update the timer
61-
62-
long latitude = myGPS.getLatitude();
63-
Serial.print(F("Lat: "));
64-
Serial.print(latitude);
65-
66-
long longitude = myGPS.getLongitude();
67-
Serial.print(F(" Long: "));
68-
Serial.print(longitude);
69-
Serial.print(F(" (degrees * 10^-7)"));
70-
71-
long altitude = myGPS.getAltitude();
72-
Serial.print(F(" Alt: "));
73-
Serial.print(altitude);
74-
Serial.print(F(" (mm)"));
75-
76-
byte SIV = myGPS.getSIV();
77-
Serial.print(F(" SIV: "));
78-
Serial.print(SIV);
79-
80-
Serial.println();
81-
Serial.print(myGPS.getYear());
82-
Serial.print("-");
83-
Serial.print(myGPS.getMonth());
84-
Serial.print("-");
85-
Serial.print(myGPS.getDay());
86-
Serial.print(" ");
87-
Serial.print(myGPS.getHour());
88-
Serial.print(":");
89-
Serial.print(myGPS.getMinute());
90-
Serial.print(":");
91-
Serial.println(myGPS.getSecond());
92-
93-
Serial.println();
94-
}
56+
//Query module only every second. Doing it more often will just cause I2C traffic.
57+
//The module only responds when a new position is available
58+
if (millis() - lastTime > 1000)
59+
{
60+
lastTime = millis(); //Update the timer
61+
62+
long latitude = myGPS.getLatitude();
63+
Serial.print(F("Lat: "));
64+
Serial.print(latitude);
65+
66+
long longitude = myGPS.getLongitude();
67+
Serial.print(F(" Long: "));
68+
Serial.print(longitude);
69+
Serial.print(F(" (degrees * 10^-7)"));
70+
71+
long altitude = myGPS.getAltitude();
72+
Serial.print(F(" Alt: "));
73+
Serial.print(altitude);
74+
Serial.print(F(" (mm)"));
75+
76+
byte SIV = myGPS.getSIV();
77+
Serial.print(F(" SIV: "));
78+
Serial.print(SIV);
79+
80+
Serial.println();
81+
Serial.print(myGPS.getYear());
82+
Serial.print("-");
83+
Serial.print(myGPS.getMonth());
84+
Serial.print("-");
85+
Serial.print(myGPS.getDay());
86+
Serial.print(" ");
87+
Serial.print(myGPS.getHour());
88+
Serial.print(":");
89+
Serial.print(myGPS.getMinute());
90+
Serial.print(":");
91+
Serial.println(myGPS.getSecond());
92+
93+
Serial.println();
94+
}
9595
}

0 commit comments

Comments
 (0)