Please see all COVID-19 updates here as some shipments may be delayed due to CDC safety and staffing guidelines. If you have an order or shipping question please refer to our Customer Support page. For technical questions please check out our Forums. Thank you for your continued support.
Member Since: January 17, 2018
Country: United States
Hello , I have a problem I can not connect the ports of my arduino to GPS when I open my monitor seriaI have 0, I copy a program above A have a sparkfun logger shield and a arduino UNO Thanks for the help and sorry for my spelling I'm french
CODE:
// If you're using an Arduino Uno, RedBoard, or any board that uses the // 0/1 UART for programming/Serial monitor-ing, use SoftwareSerial:
SoftwareSerial Serial1(1,0); // Create a SoftwareSerial
// Set gpsPort to either ssGPS if using SoftwareSerial or Serial1 if using an // Arduino with a dedicated hardware serial port
// Define the serial monitor port. On the Uno, and Leonardo this is 'Serial' // on other boards this may be 'SerialUSB'
void setup() { SerialMonitor.begin(9600); gpsPort.begin(GPS_BAUD); }
void loop() { // print position, altitude, speed, time/date, and satellites: printGPSInfo();
// "Smart delay" looks for GPS data while the Arduino's not doing anything else smartDelay(1000); }
void printGPSInfo() { // Print latitude, longitude, altitude in feet, course, speed, date, time, // and the number of visible satellites. SerialMonitor.print("Lat: "); SerialMonitor.println(tinyGPS.location.lat(), 6); SerialMonitor.print("Long: "); SerialMonitor.println(tinyGPS.location.lng(), 6); SerialMonitor.print("Alt: "); SerialMonitor.println(tinyGPS.altitude.feet()); SerialMonitor.print("Course: "); SerialMonitor.println(tinyGPS.course.deg()); SerialMonitor.print("Speed: "); SerialMonitor.println(tinyGPS.speed.mph()); SerialMonitor.print("Date: "); printDate(); SerialMonitor.print("Time: "); printTime(); SerialMonitor.print("Sats: "); SerialMonitor.println(tinyGPS.satellites.value()); SerialMonitor.println(); }
// This custom version of delay() ensures that the tinyGPS object // is being "fed". From the TinyGPS++ examples. static void smartDelay(unsigned long ms) { unsigned long start = millis(); do { // If data has come in from the GPS module while (gpsPort.available()) tinyGPS.encode(gpsPort.read()); // Send it to the encode function // tinyGPS.encode(char) continues to "load" the tinGPS object with new // data coming in from the GPS module. As full NMEA strings begin to come in // the tinyGPS library will be able to start parsing them for pertinent info } while (millis() - start < ms); }
// printDate() formats the date into dd/mm/yy. void printDate() { SerialMonitor.print(tinyGPS.date.day()); SerialMonitor.print("/"); SerialMonitor.print(tinyGPS.date.month()); SerialMonitor.print("/"); SerialMonitor.println(tinyGPS.date.year()); }
// printTime() formats the time into "hh:mm:ss", and prints leading 0's // where they're called for. void printTime() { SerialMonitor.print(tinyGPS.time.hour()); SerialMonitor.print(":"); if (tinyGPS.time.minute() < 10) SerialMonitor.print('0'); SerialMonitor.print(tinyGPS.time.minute()); SerialMonitor.print(":"); if (tinyGPS.time.second() < 10) SerialMonitor.print('0'); SerialMonitor.println(tinyGPS.time.second()); }
No public wish lists :(