Hi all! I’m new to this forum and as the first one ever!
Bill does a great job with his videos and new features. I have a few projects I’m trying to get going and I’m looking forward to some forum insights along the way. Thanks!
Welcome aboard!
👍
Hi, I'm a new member to the DroneBot workshop forum.
I was hoping to find a way to upload photos, but that feature doesn't seem to be available to me yet.
To err is human.
To really foul up, use a computer.
How does this work
So IDE, Edit, Copy as HTML, {;} and paste.
#include <TinyGPS++.h> /* This sample sketch should be the first you try out when you are testing a TinyGPS++ (TinyGPSPlus) installation. In normal use, you feed TinyGPS++ objects characters from a serial NMEA GPS device, but this example uses static strings for simplicity. */ // A sample NMEA stream. const char *gpsStream = "$GPRMC,045103.000,A,3014.1984,N,09749.2872,W,0.67,161.46,030913,,,A*7C\r\n" "$GPGGA,045104.000,3014.1985,N,09749.2873,W,1,09,1.2,211.6,M,-22.5,M,,0000*62\r\n" "$GPRMC,045200.000,A,3014.3820,N,09748.9514,W,36.88,65.02,030913,,,A*77\r\n" "$GPGGA,045201.000,3014.3864,N,09748.9411,W,1,10,1.2,200.8,M,-22.5,M,,0000*6C\r\n" "$GPRMC,045251.000,A,3014.4275,N,09749.0626,W,0.51,217.94,030913,,,A*7D\r\n" "$GPGGA,045252.000,3014.4273,N,09749.0628,W,1,09,1.3,206.9,M,-22.5,M,,0000*6F\r\n"; // The TinyGPS++ object TinyGPSPlus gps; void setup() { Serial.begin(115200); Serial.println(F("BasicExample.ino")); Serial.println(F("Basic demonstration of TinyGPS++ (no device needed)")); Serial.print(F("Testing TinyGPS++ library v. ")); Serial.println(TinyGPSPlus::libraryVersion()); Serial.println(F("by Mikal Hart")); Serial.println(); while (*gpsStream) if (gps.encode(*gpsStream++)) displayInfo(); Serial.println(); Serial.println(F("Done.")); } void loop() { } void displayInfo() { Serial.print(F("Location: ")); if (gps.location.isValid()) { Serial.print(gps.location.lat(), 6); Serial.print(F(",")); Serial.print(gps.location.lng(), 6); } else { Serial.print(F("INVALID")); } Serial.print(F(" Date/Time: ")); if (gps.date.isValid()) { Serial.print(gps.date.month()); Serial.print(F("/")); Serial.print(gps.date.day()); Serial.print(F("/")); Serial.print(gps.date.year()); } else { Serial.print(F("INVALID")); } Serial.print(F(" ")); if (gps.time.isValid()) { if (gps.time.hour() < 10) Serial.print(F("0")); Serial.print(gps.time.hour()); Serial.print(F(":")); if (gps.time.minute() < 10) Serial.print(F("0")); Serial.print(gps.time.minute()); Serial.print(F(":")); if (gps.time.second() < 10) Serial.print(F("0")); Serial.print(gps.time.second()); Serial.print(F(".")); if (gps.time.centisecond() < 10) Serial.print(F("0")); Serial.print(gps.time.centisecond()); } else { Serial.print(F("INVALID")); } Serial.println(); }
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.
Muh bad ill give this a whirl
[code] /* GPS Position Logger gps-position-logger.ino Read GPS data from BN-220 or any serial GPS sensor Requires TinyGPS++ Library Save to SD or microSD card DroneBot Workshop 2021 https://dronebotworkshop.com */ // Include required libraries #include <tinygps++.h> #include #include #include // GPS Connections static const int RXPin = 4, TXPin = 3; // GPS Baud rate (change if required) static const uint32_t GPSBaud = 9600; // SD Card Select pin const int chipSelect = 8; // Write LED //const int recLED = 7; // String to hold GPS data String gpstext; // GPS write delay counter variables // Change gpsttlcount as required int gpscount = 0; int gpsttlcount = 30; // TinyGPS++ object TinyGPSPlus gps; // SoftwareSerial connection to the GPS device SoftwareSerial ss(RXPin, TXPin); void setup() { // Set LED pin as output //pinMode(recLED, OUTPUT); // Start Serial Monitor for debugging Serial.begin(115200); // Start SoftwareSerial ss.begin(GPSBaud); // Initialize SD card if (!SD.begin(chipSelect)) { Serial.println("Card failed, or not present"); //don't do anything more: while (1); } Serial.println("card initialized."); // Blink LED so we know we are ready // digitalWrite(recLED, HIGH); // delay(500); // digitalWrite(recLED, LOW); // delay(500); // digitalWrite(recLED, HIGH); // delay(500); // digitalWrite(recLED, LOW); // delay(500); // digitalWrite(recLED, HIGH); // delay(500); // digitalWrite(recLED, LOW); } void loop() { // Turn off LED // digitalWrite(recLED, LOW); // See if data available while (ss.available() > 0) if (gps.encode(ss.read())) // See if we have a complete GPS data string if (displayInfo() != "0") { // Get GPS string gpstext = displayInfo(); // Check GPS Count Serial.println(gpscount); if (gpscount == gpsttlcount) { // LED On to indicate data to write to SD card // digitalWrite(recLED, HIGH); //Open the file on card for writing File dataFile = SD.open("gpslog.csv", FILE_WRITE); if (dataFile) { // If the file is available, write to it and close the file dataFile.println(gpstext); dataFile.close(); // Serial print GPS string for debugging Serial.println(gpstext); } // If the file isn't open print an error message for debugging else { Serial.println("error opening datalog.txt"); } } // Increment GPS Count gpscount = gpscount + 1; if (gpscount > gpsttlcount) { gpscount = 0; } } } // Function to return GPS string String displayInfo() { // Define empty string to hold output String gpsdata = ""; // Get latitude and longitude if (gps.location.isValid()) { gpsdata = String(gps.location.lat(), 6); gpsdata += (","); gpsdata += String(gps.location.lng(), 6); gpsdata += (","); } else { return "0"; } // Get Date if (gps.date.isValid()) { gpsdata += String(gps.date.year()); gpsdata += ("-"); if (gps.date.month() < 10) gpsdata += ("0"); gpsdata += String(gps.date.month()); gpsdata += ("-"); if (gps.date.day() < 10) gpsdata += ("0"); gpsdata += String(gps.date.day()); } else { return "0"; } // Space between date and time gpsdata += (" "); // Get time if (gps.time.isValid()) { if (gps.time.hour() < 10) gpsdata += ("0"); gpsdata += String(gps.time.hour()); gpsdata += (":"); if (gps.time.minute() < 10) gpsdata += ("0"); gpsdata += String(gps.time.minute()); gpsdata += (":"); if (gps.time.second() < 10) gpsdata += ("0"); gpsdata += String(gps.time.second()); } else { return "0"; } // Return completed string return gpsdata; } [/code]</tinygps++.h>
@madmike970 Nope. Copy as HTML. Then {:}
#include <TinyGPS++.h> /* This sample sketch should be the first you try out when you are testing a TinyGPS++ (TinyGPSPlus) installation. In normal use, you feed TinyGPS++ objects characters from a serial NMEA GPS device, but this example uses static strings for simplicity. */ // A sample NMEA stream. const char *gpsStream = "$GPRMC,045103.000,A,3014.1984,N,09749.2872,W,0.67,161.46,030913,,,A*7C\r\n" "$GPGGA,045104.000,3014.1985,N,09749.2873,W,1,09,1.2,211.6,M,-22.5,M,,0000*62\r\n" "$GPRMC,045200.000,A,3014.3820,N,09748.9514,W,36.88,65.02,030913,,,A*77\r\n" "$GPGGA,045201.000,3014.3864,N,09748.9411,W,1,10,1.2,200.8,M,-22.5,M,,0000*6C\r\n" "$GPRMC,045251.000,A,3014.4275,N,09749.0626,W,0.51,217.94,030913,,,A*7D\r\n" "$GPGGA,045252.000,3014.4273,N,09749.0628,W,1,09,1.3,206.9,M,-22.5,M,,0000*6F\r\n"; // The TinyGPS++ object TinyGPSPlus gps; void setup() { Serial.begin(115200); Serial.println(F("BasicExample.ino")); Serial.println(F("Basic demonstration of TinyGPS++ (no device needed)")); Serial.print(F("Testing TinyGPS++ library v. ")); Serial.println(TinyGPSPlus::libraryVersion()); Serial.println(F("by Mikal Hart")); Serial.println(); while (*gpsStream) if (gps.encode(*gpsStream++)) displayInfo(); Serial.println(); Serial.println(F("Done.")); } void loop() { } void displayInfo() { Serial.print(F("Location: ")); if (gps.location.isValid()) { Serial.print(gps.location.lat(), 6); Serial.print(F(",")); Serial.print(gps.location.lng(), 6); } else { Serial.print(F("INVALID")); } Serial.print(F(" Date/Time: ")); if (gps.date.isValid()) { Serial.print(gps.date.month()); Serial.print(F("/")); Serial.print(gps.date.day()); Serial.print(F("/")); Serial.print(gps.date.year()); } else { Serial.print(F("INVALID")); } Serial.print(F(" ")); if (gps.time.isValid()) { if (gps.time.hour() < 10) Serial.print(F("0")); Serial.print(gps.time.hour()); Serial.print(F(":")); if (gps.time.minute() < 10) Serial.print(F("0")); Serial.print(gps.time.minute()); Serial.print(F(":")); if (gps.time.second() < 10) Serial.print(F("0")); Serial.print(gps.time.second()); Serial.print(F(".")); if (gps.time.centisecond() < 10) Serial.print(F("0")); Serial.print(gps.time.centisecond()); } else { Serial.print(F("INVALID")); } Serial.println(); }
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.