jimallen60:
I believe that the World Clock Sketch that I have been using to base the TimeZone and EDT setting was written to use an RTC. Here I am using a GPS, so I think that I will need to change some commands to pull the time from the GPS….
I guess you could say, I'm SLOWLY learning….
Thanks for the input guy's…..
Yes.
But "commands" as you say are actually functions in a library or your code. The Adafruit GPS library provides functions for you to use directly!
Ladyada already did the work for you:
ode:
/*
Originally based on Adafruit example sketch: "parsing"
Utilizes the Adafruit_GPS library https://github.com/adafruit/Adafruit-GPS-Library
20131115: GPS_Parsing_Test
Heavily mucked by M. Ray Burnette to simply use (most) any dumb serial TTL GPS for time-date
Tested with ancient #28146 Parallax module
Arduino 1.0.5:
Program: 9090 bytes
(.text + .data + .bootloader)
Data: 754 bytes
(.data + .bss + .noinit)
*/
#include "Adafruit_GPS.h"
#include <SoftwareSerial.h>
#include <Streaming.h>
// Connect the GPS TX (transmit) pin to Digital 3
SoftwareSerial mySerial(3, 2);
Adafruit_GPS GPS(&mySerial);
// Set GPSDEBUG to 'false' to turn off echoing the GPS data to the Serial console
// Set to 'true' if you want to debug and listen to the raw GPS sentences.
// Could be as simple as checking a digital pin to-Gnd state
#define GPSDEBUG false // should be a check of a digital pin to Gnd
uint8_t last_seconds ;
uint8_t TimeZoneHour = -5 ; // needs to be a pin-to-ground adjustment for DST
uint8_t LocalHour ;
void setup()
{
// connect at 115200 so we can read the GPS fast enough and echo without dropping chars
Serial.begin(115200);
Serial.println("GPS time-date:");
// Some GPS are 4800 and some are 9600 or faster
GPS.begin(4800);
delay(1000);
// Add a DST check of a digital pin for DayLightSavingTime or
// Use multiple digital pins to set any TimeZone
}
void loop()
{
// read data from the GPS
char c = GPS.read();
if (GPSDEBUG) // Raw character echo to monitor
if (c) Serial.print(c);
// if a sentence is received, check the checksum, parse it...
if (GPS.newNMEAreceived()) {
if (!GPS.parse(GPS.lastNMEA())) // this also sets the newNMEAreceived() flag to false
return; // return to top of loop() if sentence does not verify correctly or completely
}
// BIG if() active only once per second since this sketch is time-date focused
if (last_seconds != GPS.seconds) { last_seconds = GPS.seconds;
LocalHour = GPS.hour + TimeZoneHour;
Serial.print("\nTime: ") ;
Serial << ((LocalHour<10)?"0":"") ;
Serial.print(LocalHour, DEC);
Serial << (':') ;
Serial << ((GPS.minute<10)?"0":"") ;
Serial.print (GPS.minute, DEC);
Serial << (':') ;
Serial << ((GPS.seconds<10)?"0":"") ;
Serial.print(GPS.seconds, DEC) ;
Serial.print("\nDate: ");
Serial << ((GPS.day<10)?"0":"") ;
Serial.print(GPS.day, DEC) ; //DD
Serial << "/" << ((GPS.month<10)?"0":"") ;
Serial.print(GPS.month, DEC) ; //MM
Serial << "/20" ;
Serial.println(GPS.year, DEC) ; //YYYY