|
| 1 | +/* |
| 2 | + Some Description |
| 3 | + By: Elias Santistevan |
| 4 | + SparkFun Electronics |
| 5 | + Date: February |
| 6 | + License: MIT. See license file for more information but you can |
| 7 | + basically do whatever you want with this code. |
| 8 | +
|
| 9 | +
|
| 10 | + Feel like supporting open source hardware? |
| 11 | + Buy a board from SparkFun! |
| 12 | + NEO-M8U: https://www.sparkfun.com/products/15136 |
| 13 | + ZED-F9R: https://www.sparkfun.com/products/15136 |
| 14 | +
|
| 15 | + Hardware Connections: |
| 16 | + Plug a Qwiic cable into the GPS and a BlackBoard |
| 17 | + If you don't have a platform with a Qwiic connection use the SparkFun Qwiic Breadboard Jumper (https://www.sparkfun.com/products/14425) |
| 18 | + Open the serial monitor at 115200 baud to see the output |
| 19 | +*/ |
| 20 | + |
| 21 | +#include <Wire.h> //Needed for I2C to GPS |
| 22 | + |
| 23 | +#include <SparkFun_Ublox_Arduino_Library.h> //http://librarymanager/All#SparkFun_Ublox_GPS |
| 24 | +SFE_UBLOX_GPS myGPS; |
| 25 | + |
| 26 | +void setup() |
| 27 | +{ |
| 28 | + Serial.begin(115200); |
| 29 | + while (!Serial); //Wait for user to open terminal |
| 30 | + Serial.println("SparkFun Ublox Example"); |
| 31 | + |
| 32 | + Wire.begin(); |
| 33 | + |
| 34 | + if (myGPS.begin() == false) //Connect to the Ublox module using Wire port |
| 35 | + { |
| 36 | + Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing.")); |
| 37 | + while (1); |
| 38 | + } |
| 39 | + |
| 40 | + myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise) |
| 41 | +} |
| 42 | + |
| 43 | +void loop() |
| 44 | +{ |
| 45 | + if (myGPS.getEsfInfo()) |
| 46 | + Serial.println(myGPS.imuMeas.fusionMode); |
| 47 | + |
| 48 | + if (myGPS.getEsfMeas()) |
| 49 | + { |
| 50 | + Serial.print("X validity: "); |
| 51 | + Serial.println(myGPS.imuMeas.xAngRateVald); |
| 52 | + Serial.print("X: "); |
| 53 | + Serial.println(myGPS.imuMeas.xAngRate); |
| 54 | + Serial.print("Y validity: "); |
| 55 | + Serial.println(myGPS.imuMeas.yAngRateVald); |
| 56 | + Serial.print("Y: "); |
| 57 | + Serial.println(myGPS.imuMeas.yAngRate); |
| 58 | + Serial.print("Z validity: "); |
| 59 | + Serial.println(myGPS.imuMeas.zAngRateVald); |
| 60 | + Serial.print("Z: "); |
| 61 | + Serial.println(myGPS.imuMeas.zAngRate); |
| 62 | + } |
| 63 | + delay(250); |
| 64 | +} |
| 65 | + |
0 commit comments