Go Down

Topic: Time Library added to Playground (Read 39 times) previous topic - next topic

mem

Lets see if we can find out why you had problems running the example GPS code, perhaps that may be related to the problem you are having in your current sketch.

Was the example code that locked up modified, and if so, can you post the code you ran.

Eddie Schnell

OK, I went back to the original GPS code and put it into my code. It does not lock up everything, but it's stuck in 1970. It does seem to be counting in the loops though.

The code is too long to post, it is viewable at http://www.schnellnetworks.com/code.html

Thanks,
Eddie

Eddie Schnell

Had a breakthrough. When I pressed some of the buttons on the door, it magically got the correct time on the screen. I changed the startup code to wait for serial data to be available by using the feedgps function, then called the gps.encode line for the Time library to read, and now it seems to be getting the correct time at startup.

Code: [Select]
Serial.println("Waiting for GPS Time...");                          // debug
 setSyncProvider(gpsTimeSync);
 while(feedgps() != true) {                                          // if feedgps is false
   delay(50);                                                        // take a breath
 }
 gps.encode(Serial3.read()); // process gps messages


Thanks,
Eddie Schnell

mem

Eddie, good to hear you have it working, it looks like an interesting project. Perhaps you could post some more details in the exhibition forum when you are ready.

For the benefit of others  that may want to test using the GPS example code in the download, did that work as expected with your GPS after you changed the serial port for the Mega, but before you added any logic for your application?

transfinite

In reply #4 Veronica pointed out:
Code: [Select]
#include <time.h>

in Time.cpp should have a capital T.

This is the case ( ;)) in the DS1307RTC.h file also.

It took me way too long to figure out this was the problem.

Otherwise, great library.  I've been using the old one since last June, and it's nice to have RTC support integrated.
Also I was _really_ glad to see the default TIME_HEADER changed to 'T' instead of 255.

-transfinite

Go Up