Introduction
Bonezegei GPS Arduino Library is a library that allows Arduino users to easily interface with GPS modules and obtain location data. The library supports NMEA Sentence, and can parse and decode the messages from the GPS module.
Disclaimer
The code and libraries provided by Bonezegei is intended for informational and educational purposes only. Bonezegei does not own or manufacture the hardware associated with the code. The code is provided "as is" without any warranty, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and non-infringement. In no event shall Bonezegei be liable for any claim, damages, or other liability arising from the use of the code or the hardware. Users are solely responsible for ensuring that their use of the code complies with all applicable laws and regulations.
1. Using Serial Port
This applies if the microcontroller has two serial ports since one of them is used for debugging. However, this example shows how to retrieve data from a GPS module using a serial port.
/* Author: Bonezegei (Jofel Batutay) Date: August 2023 Tested using ESP32 Serial 2 GPS */ #include <Bonezegei_GPS.h> //declare GPS connected to Serial2 Bonezegei_GPS gps(Serial2); void setup() { Serial.begin(9600); gps.begin(9600); } void loop() { if(gps.getData()==GPS_VALID){ Serial.printf("lat: %lf lon:%lf\n" , gps.latitude,gps.longitude); } }
2. Using Bonezegei_SoftSerial
GPS Connected to Software Serial pins.The SoftSerial can be declare as RX only for GPS by delcaring with only 1 pin the SoftSerial is set by default with receive pin,<strong style="font-weight:normal"> Bonezegei_SoftSerial softSerial(25);</strong>
/* Author: Bonezegei (Jofel Batutay) Date: August 2023 Tested using ESP32 Bonezegei SoftSerial GPS */ #include <Bonezegei_GPS.h> // RX TX Bonezegei_SoftSerial softSerial(25,26); Bonezegei_GPS gps(softSerial); void setup() { Serial.begin(9600); gps.begin(9600); } void loop() { if(gps.getData()==GPS_VALID){ Serial.printf("lat: %lf lon:%lf\n" , gps.latitude,gps.longitude); } }
References
- Batutay, Jofel. (2023). Arduino Library Installation. Bonezegei. https://bonezegei.com/?c=resources/tutorial&&d=resources/tutorial/libraries/install&&nav=1
- Batutay, Jofel. (2023). Bonezegei SoftSerial. ResearchGate. https://doi.org/10.13140/RG.2.2.28003.12325.
Cite this
- Batutay, Jofel. (2023). Bonezegei GPS Library. ResearchGate. https://doi.org/10.13140/RG.2.2.25171.96807/1.