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

Commit 3007665

Browse files
committed
Re-arranging example directories. Moving Wire.begin back into sketches (not lib).
1 parent 9f3dcf4 commit 3007665

File tree

7 files changed

+141
-5
lines changed

7 files changed

+141
-5
lines changed

examples/Example1_BasicNMEARead/Example1_BasicNMEARead.ino

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Read NMEA sentences over I2C using Ublox module SAM-M8Q, NEO-M8P, etc
2+
Read NMEA sentences over I2C using Ublox module SAM-M8Q, NEO-M8P, ZED-F9P, etc
33
By: Nathan Seidle
44
SparkFun Electronics
55
Date: August 22nd, 2018
@@ -10,7 +10,10 @@
1010
them to the serial port
1111
1212
Feel like supporting open source hardware?
13-
Buy a board from SparkFun! https://www.sparkfun.com/products/14980
13+
Buy a board from SparkFun!
14+
ZED-F9P RTK2: https://www.sparkfun.com/products/15136
15+
NEO-M8P RTK: https://www.sparkfun.com/products/15005
16+
SAM-M8Q: https://www.sparkfun.com/products/15106
1417
1518
Hardware Connections:
1619
Plug a Qwiic cable into the GPS and a BlackBoard
@@ -28,7 +31,9 @@ void setup()
2831
Serial.begin(115200);
2932
Serial.println("Ublox GPS I2C Test");
3033

31-
myGPS.begin(Wire);
34+
Wire.begin();
35+
36+
myGPS.begin();
3237
if (myGPS.isConnected() == false)
3338
{
3439
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));

examples/Example2_NMEAParsing/Example2_NMEAParsing.ino

+7-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
This example will output your current long/lat and satellites in view
1111
1212
Feel like supporting open source hardware?
13-
Buy a board from SparkFun! https://www.sparkfun.com/products/14980
13+
Buy a board from SparkFun!
14+
ZED-F9P RTK2: https://www.sparkfun.com/products/15136
15+
NEO-M8P RTK: https://www.sparkfun.com/products/15005
16+
SAM-M8Q: https://www.sparkfun.com/products/15106
1417
1518
For more MicroNMEA info see https://github.com/stevemarple/MicroNMEA
1619
@@ -35,7 +38,9 @@ void setup()
3538
Serial.begin(115200);
3639
Serial.println("Ublox GPS I2C Test");
3740

38-
myGPS.begin(Wire);
41+
Wire.begin();
42+
43+
myGPS.begin();
3944
if (myGPS.isConnected() == false)
4045
{
4146
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*
2+
Reading lat and long via UBX binary commands - no more NMEA parsing!
3+
By: Nathan Seidle
4+
SparkFun Electronics
5+
Date: January 3rd, 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 its lat/long/altitude. Leave NMEA
10+
parsing behind. Now you can simply ask the module for the datums you want!
11+
12+
Feel like supporting open source hardware?
13+
Buy a board from SparkFun!
14+
ZED-F9P RTK2: https://www.sparkfun.com/products/15136
15+
NEO-M8P RTK: https://www.sparkfun.com/products/15005
16+
SAM-M8Q: https://www.sparkfun.com/products/15106
17+
18+
Hardware Connections:
19+
Plug a Qwiic cable into the GPS and a BlackBoard
20+
If you don't have a platform with a Qwiic connection use the SparkFun Qwiic Breadboard Jumper (https://www.sparkfun.com/products/14425)
21+
Open the serial monitor at 115200 baud to see the output
22+
*/
23+
24+
#include <Wire.h> //Needed for I2C to GPS
25+
26+
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_Ublox_GPS
27+
SFE_UBLOX_GPS myGPS;
28+
29+
long lastTime = 0; //Tracks the passing of 2000ms (2 seconds)
30+
31+
void setup()
32+
{
33+
Serial.begin(115200);
34+
while (!Serial); //Wait for user to open terminal
35+
Serial.println("Ublox high precision accuracy example");
36+
37+
myGPS.begin(); //Connect to the Ublox module using Wire port
38+
if (myGPS.isConnected() == false)
39+
{
40+
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
41+
while (1);
42+
}
43+
44+
Wire.setClock(400000); //Increase I2C clock speed to 400kHz
45+
46+
}
47+
48+
void loop()
49+
{
50+
myGPS.checkUblox(); //See if new data is available. Process bytes as they come in.
51+
52+
delay(250); //Don't pound too hard on the I2C bus
53+
54+
//Every other second print the current 3D position accuracy
55+
if(millis() - lastTime > 1000)
56+
{
57+
long accuracy = myGPS.getPositionAccuracy();
58+
Serial.print("3D Positional Accuracy: ");
59+
Serial.print(accuracy);
60+
Serial.println("mm");
61+
}
62+
63+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*
2+
Send UBX binary commands to enable RTCM sentences on Ublox NEO-M8P-2 module
3+
By: Nathan Seidle
4+
SparkFun Electronics
5+
Date: September 7th, 2018
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 does all steps to configure and enable a NEO-M8P-2 as a base station:
10+
Begin Survey-In
11+
Once we've achieved 2m accuracy and 300s have passed, survey is complete
12+
Enable four RTCM messages
13+
Begin outputting RTCM bytes
14+
15+
Feel like supporting open source hardware?
16+
Buy a board from SparkFun! https://www.sparkfun.com/products/14980
17+
18+
Hardware Connections:
19+
Plug a Qwiic cable into the GPS and a BlackBoard
20+
If you don't have a platform with a Qwiic connection use the SparkFun Qwiic Breadboard Jumper (https://www.sparkfun.com/products/14425)
21+
Open the serial monitor at 115200 baud to see the output
22+
*/
23+
24+
#include <Wire.h> //Needed for I2C to GPS
25+
26+
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_Ublox_GPS
27+
SFE_UBLOX_GPS myGPS;
28+
29+
long lastTime = 0; //Tracks the passing of 2000ms (2 seconds)
30+
31+
void setup()
32+
{
33+
Serial.begin(115200);
34+
while (!Serial); //Wait for user to open terminal
35+
Serial.println("Ublox high precision accuracy example");
36+
37+
myGPS.begin(); //Connect to the Ublox module using Wire port
38+
if (myGPS.isConnected() == false)
39+
{
40+
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
41+
while (1);
42+
}
43+
44+
Wire.setClock(400000); //Increase I2C clock speed to 400kHz
45+
46+
}
47+
48+
void loop()
49+
{
50+
myGPS.checkUblox(); //See if new data is available. Process bytes as they come in.
51+
52+
delay(250); //Don't pound too hard on the I2C bus
53+
54+
//Every other second print the current 3D position accuracy
55+
if(millis() - lastTime > 1000)
56+
{
57+
long accuracy = myGPS.getPositionAccuracy();
58+
Serial.print("3D Positional Accuracy: ");
59+
Serial.print(accuracy);
60+
Serial.println("mm");
61+
}
62+
63+
}

0 commit comments

Comments
 (0)