Untitled
unknown
c_cpp
2 years ago
812 B
12
Indexable
#include <TinyGPS++.h> #include <SoftwareSerial.h> static const int RXPin = 1, TXPin = 0; static const uint32_t GPSBaud = 9600; // The TinyGPS++ object TinyGPSPlus gps; // The serial connection to the GPS device SoftwareSerial ss(RXPin, TXPin); void setup(){ Serial.begin(9600); ss.begin(GPSBaud); } void loop() { while (ss.available() > 0){ gps.encode(ss.read()); if (gps.location.isUpdated()){ // Latitude in degrees (double) Serial.print("Latitude= "); Serial.print(gps.location.lat(), 6); // Longitude in degrees (double) Serial.print(" Longitude= "); Serial.println(gps.location.lng(), 6); Serial.println(gps.speed.kmph()); delay(1000); } } } //myservo.write(gps.speed.kmph());
Editor is loading...
Leave a Comment