Devices & Components
Arduino Uno Rev3
GPS Module (Generic)
Jumper wires (generic)
Solderless Breadboard Half Size
Software & Tools
Arduino IDE
Project description
Code
Code
arduino
Code
1#include <TinyGPS++.h> 2#include <SoftwareSerial.h> 3 4static const int RXPin = 4, TXPin = 3; 5static const uint32_t GPSBaud = 9600; 6 7// The TinyGPS++ object 8TinyGPSPlus gps; 9 10// The serial connection to the GPS device 11SoftwareSerial ss(RXPin, TXPin); 12 13void setup(){ 14 Serial.begin(9600); 15 ss.begin(GPSBaud); 16} 17 18void loop(){ 19 // This sketch displays information every time a new sentence is correctly encoded. 20 while (ss.available() > 0){ 21 gps.encode(ss.read()); 22 if (gps.location.isUpdated()){ 23 Serial.print("Latitude= "); 24 Serial.print(gps.location.lat(), 6); 25 Serial.print(" Longitude= "); 26 Serial.println(gps.location.lng(), 6); 27 } 28 } 29}
Code
arduino
Code
1#include <TinyGPS++.h> 2#include <SoftwareSerial.h> 3 4static const int RXPin = 4, TXPin = 3; 5static const uint32_t GPSBaud = 9600; 6 7// The TinyGPS++ object 8TinyGPSPlus gps; 9 10// The serial connection to the GPS device 11SoftwareSerial ss(RXPin, TXPin); 12 13void setup(){ 14 Serial.begin(9600); 15 ss.begin(GPSBaud); 16} 17 18void loop(){ 19 // This sketch displays information every time a new sentence is correctly encoded. 20 while (ss.available() > 0){ 21 gps.encode(ss.read()); 22 if (gps.location.isUpdated()){ 23 Serial.print("Latitude= "); 24 Serial.print(gps.location.lat(), 6); 25 Serial.print(" Longitude= "); 26 Serial.println(gps.location.lng(), 6); 27 } 28 } 29}
Downloadable files
Schematics
Schematics
Schematics

Comments
Only logged in users can leave comments