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

Commit a284616

Browse files
committed
Merge branch 'master' into pr/18
2 parents 8f1b20b + 21b708a commit a284616

File tree

11 files changed

+887
-168
lines changed

11 files changed

+887
-168
lines changed

ISSUE_TEMPLATE.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
### Subject of the issue
2+
Describe your issue here. If you reference a datasheet please specify which one and in which section (ie, the protocol manual, section 5.1.2). Additionally, screenshots are easy to paste into github.
3+
4+
### Your workbench
5+
* What development board or microcontroller are you using?
6+
* What version of hardware or breakout board are you using?
7+
* How is the breakout board wired to your microcontroller?
8+
* How is everything being powered?
9+
* Are there any additional details that may help us help you?
10+
11+
### Steps to reproduce
12+
Tell us how to reproduce this issue. Please post stripped down example code demonstrating your issue.
13+
14+
### Expected behavior
15+
Tell us what should happen
16+
17+
### Actual behavior
18+
Tell us what happens instead

examples/Example14_DebugOutput/Example14_DebugOutput.ino

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,19 @@ void loop()
7575
Serial.print(F(" SIV: "));
7676
Serial.print(SIV);
7777

78+
Serial.println();
79+
Serial.print(myGPS.getYear());
80+
Serial.print("-");
81+
Serial.print(myGPS.getMonth());
82+
Serial.print("-");
83+
Serial.print(myGPS.getDay());
84+
Serial.print(" ");
85+
Serial.print(myGPS.getHour());
86+
Serial.print(":");
87+
Serial.print(myGPS.getMinute());
88+
Serial.print(":");
89+
Serial.println(myGPS.getSecond());
90+
7891
Serial.println();
7992
}
8093
}

examples/Example15_GetDateTime/Example15_GetDateTime.ino

Lines changed: 56 additions & 56 deletions
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
}
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
/*
2+
Getting time and date using Ublox commands
3+
By: davidallenmann
4+
SparkFun Electronics
5+
Date: April 16th, 2019
6+
License: MIT. See license file for more information but you can
7+
basically do whatever you want with this code.
8+
9+
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
11+
dramatically.
12+
13+
Leave NMEA parsing behind. Now you can simply ask the module for the datums you want!
14+
15+
Feel like supporting open source hardware?
16+
Buy a board from SparkFun!
17+
ZED-F9P RTK2: https://www.sparkfun.com/products/15136
18+
NEO-M8P RTK: https://www.sparkfun.com/products/15005
19+
SAM-M8Q: https://www.sparkfun.com/products/15106
20+
21+
Hardware Connections:
22+
Plug a Qwiic cable into the GPS and a BlackBoard
23+
If you don't have a platform with a Qwiic connection use the SparkFun Qwiic Breadboard Jumper (https://www.sparkfun.com/products/14425)
24+
Open the serial monitor at 115200 baud to see the output
25+
*/
26+
27+
#include <Wire.h> //Needed for I2C to GPS
28+
29+
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_Ublox_GPS
30+
SFE_UBLOX_GPS myGPS;
31+
32+
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to Ublox module.
33+
34+
void setup()
35+
{
36+
Serial.begin(500000); //Increase serial speed to maximize
37+
while (!Serial)
38+
; //Wait for user to open terminal
39+
Serial.println("SparkFun Ublox Example");
40+
41+
Wire.begin();
42+
Wire.setClock(400000);
43+
44+
if (myGPS.begin() == false) //Connect to the Ublox module using Wire port
45+
{
46+
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
47+
while (1)
48+
;
49+
}
50+
51+
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
52+
myGPS.saveConfiguration(); //Save the current settings to flash and BBR
53+
54+
//myGPS.enableDebugging(); //Enable debug messages over Serial (default)
55+
56+
myGPS.setNavigationFrequency(10); //Set output to 10 times a second
57+
byte rate = myGPS.getNavigationFrequency(); //Get the update rate of this module
58+
Serial.print("Current update rate:");
59+
Serial.println(rate);
60+
61+
}
62+
63+
void loop()
64+
{
65+
//Query module only every second. Doing it more often will just cause I2C traffic.
66+
//The module only responds when a new position is available
67+
if (millis() - lastTime > 10)
68+
{
69+
lastTime = millis(); //Update the timer
70+
71+
long latitude = myGPS.getLatitude();
72+
Serial.print(F("Lat: "));
73+
Serial.print(latitude);
74+
75+
long longitude = myGPS.getLongitude();
76+
Serial.print(F(" Long: "));
77+
Serial.print(longitude);
78+
Serial.print(F(" (degrees * 10^-7)"));
79+
80+
long altitude = myGPS.getAltitude();
81+
Serial.print(F(" Alt: "));
82+
Serial.print(altitude);
83+
Serial.print(F(" (mm)"));
84+
85+
byte SIV = myGPS.getSIV();
86+
Serial.print(F(" SIV: "));
87+
Serial.print(SIV);
88+
89+
Serial.print(myGPS.getYear());
90+
Serial.print("-");
91+
Serial.print(myGPS.getMonth());
92+
Serial.print("-");
93+
Serial.print(myGPS.getDay());
94+
Serial.print(" ");
95+
Serial.print(myGPS.getHour());
96+
Serial.print(":");
97+
Serial.print(myGPS.getMinute());
98+
Serial.print(":");
99+
Serial.print(myGPS.getSecond());
100+
Serial.print(".");
101+
Serial.print(myGPS.getNanosecond());
102+
103+
Serial.println();
104+
}
105+
}
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
/*
2+
Getting time and date using Ublox commands
3+
By: Nathan Seidle
4+
SparkFun Electronics
5+
Date: April 16th, 2019
6+
License: MIT. See license file for more information but you can
7+
basically do whatever you want with this code.
8+
9+
This example shows how to use the Millisecond and Nanosecond output as well as increase the
10+
I2C speed (100 to 400kHz), and serial output (115200 to 500kbps).
11+
12+
Leave NMEA parsing behind. Now you can simply ask the module for the datums you want!
13+
14+
Feel like supporting open source hardware?
15+
Buy a board from SparkFun!
16+
ZED-F9P RTK2: https://www.sparkfun.com/products/15136
17+
NEO-M8P RTK: https://www.sparkfun.com/products/15005
18+
SAM-M8Q: https://www.sparkfun.com/products/15106
19+
20+
Hardware Connections:
21+
Plug a Qwiic cable into the GPS and a BlackBoard
22+
If you don't have a platform with a Qwiic connection use the SparkFun Qwiic Breadboard Jumper (https://www.sparkfun.com/products/14425)
23+
Open the serial monitor at 115200 baud to see the output
24+
*/
25+
26+
#include <Wire.h> //Needed for I2C to GPS
27+
28+
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_Ublox_GPS
29+
SFE_UBLOX_GPS myGPS;
30+
31+
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to Ublox module.
32+
33+
void setup()
34+
{
35+
Serial.begin(500000); //Increase serial speed to maximize
36+
while (!Serial)
37+
; //Wait for user to open terminal
38+
Serial.println("SparkFun Ublox Example");
39+
40+
Wire.begin();
41+
Wire.setClock(400000);
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+
52+
//myGPS.enableDebugging(); //Enable debug messages over Serial (default)
53+
54+
myGPS.setNavigationFrequency(10); //Set output to 10 times a second
55+
byte rate = myGPS.getNavigationFrequency(); //Get the update rate of this module
56+
Serial.print("Current update rate:");
57+
Serial.println(rate);
58+
59+
myGPS.saveConfiguration(); //Save the current settings to flash and BBR
60+
61+
pinMode(2, OUTPUT); //For debug capture
62+
digitalWrite(2, HIGH);
63+
}
64+
65+
void loop()
66+
{
67+
//Query module very often to get max update rate
68+
if (millis() - lastTime > 10)
69+
{
70+
lastTime = millis(); //Update the timer
71+
72+
long latitude = myGPS.getLatitude();
73+
Serial.print(F("Lat: "));
74+
Serial.print(latitude);
75+
76+
long longitude = myGPS.getLongitude();
77+
Serial.print(F(" Long: "));
78+
Serial.print(longitude);
79+
Serial.print(F(" (degrees * 10^-7)"));
80+
81+
long altitude = myGPS.getAltitude();
82+
Serial.print(F(" Alt: "));
83+
Serial.print(altitude);
84+
Serial.print(F(" (mm)"));
85+
86+
byte SIV = myGPS.getSIV();
87+
Serial.print(F(" SIV: "));
88+
Serial.print(SIV);
89+
90+
Serial.print(" ");
91+
Serial.print(myGPS.getYear());
92+
Serial.print("-");
93+
Serial.print(myGPS.getMonth());
94+
Serial.print("-");
95+
Serial.print(myGPS.getDay());
96+
Serial.print(" ");
97+
Serial.print(myGPS.getHour());
98+
Serial.print(":");
99+
Serial.print(myGPS.getMinute());
100+
Serial.print(":");
101+
Serial.print(myGPS.getSecond());
102+
Serial.print(".");
103+
//Pretty print leading zeros
104+
int mseconds = myGPS.getMillisecond();
105+
if(mseconds < 100) Serial.print("0");
106+
if(mseconds < 10) Serial.print("0");
107+
Serial.print(mseconds);
108+
109+
Serial.print(" nanoSeconds: ");
110+
Serial.print(myGPS.getNanosecond());
111+
112+
Serial.println();
113+
}
114+
}

0 commit comments

Comments
 (0)