Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- The TEL0157 GPS Receiver from DF Robot uses the UART interface to communicate with a microcontroller. It sends data in the form of NMEA 0183 sentences which include information such as latitude, longitude, altitude, speed, and more.
- This code reads the data from the GPS module and prints the raw NMEA sentences to the Serial Monitor.
- If you want to parse the NMEA sentences to get useful data (like latitude and longitude), you might want to use a library like TinyGPS++.
- Remember to connect the GPS module's TX pin to the Arduino's RX pin (in this case pin 2), and the GPS module's RX pin to the Arduino's TX pin (in this case pin 3). Also, make sure to provide the appropriate power supply to the GPS module (usually 3.3V or 5V, check your module's datasheet). Always double-check the datasheet/manual of your GPS module for specific instructions and information.
- Please adjust the pin numbers and rest of the code according to your exact setup and requirements.
- Here is a simple Arduino code snippet that reads and prints the raw NMEA sentences from the GPS module:
- */
- #include <SoftwareSerial.h>
- // Choose two Arduino pins to use for software serial
- int rxPin = 2;
- int txPin = 3;
- // Set up the GPS module baud rate (default is 9600 for the TEL0157)
- int gpsBaud = 9600;
- // Create a software serial port
- SoftwareSerial gpsSerial(rxPin, txPin);
- void setup() {
- // Start the hardware serial port for the serial monitor
- Serial.begin(9600);
- // Start the software serial port
- gpsSerial.begin(gpsBaud);
- }
- void loop() {
- // Read data from the GPS module
- while (gpsSerial.available() > 0) {
- char c = gpsSerial.read();
- // Print data to the serial monitor
- Serial.print(c);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement