Setting the initial time WITHIN the setup() works alright but using the same code (for example) on a button press seems to hang my arduino. (loop() is not running anymore)
setTime(13, 12, 11, 2, 11, 2014);
RTC.set(now());
Could it be a problem in this library.? Maybe there should be a stop command first before writing to the RTC? Any suggestion or knowledge about this library?
btw, only using setTime works alright, but it's the RTC.set(now()) command that hangt my arduino.
but using the same code (for example) on a button press seems to hang my arduino. (loop() is not running anymore)
Please post the example code using the button press which hangs the Arduino. It's not clear how you are loading the values into the setTime function, and how you are calling the RTC.set with buttons.
KenF, putting it in there twice gives me the same result.
// Interrupt service routine for interrupt 1
void incrementTime() {
buttonincr_time = millis();
//check to see if increment() was called in the last 250 milliseconds
if (buttonincr_time - last_buttonincr_time > 250)
{
uren = hour() + 1;
/*
setTime(uren, minute(), second(), day(), month(), year());
RTC.set(now());
*/
setTime(13, 12, 11, 2, 11, 2014);
RTC.set(now());
}
//remember last millis for next button press
last_buttonincr_time = buttonincr_time;
}
Like I wrote, commenting RTC.set(now()); and everything works as aspected. As you can see, I tried to set time with a variable but also hardcoded as above. But both ways work and the Time library updates the time. But calling RTC.set(now()) stop the loop()
LarryD: don't have the wiring digital, only on a breadboard If above is not enough I can post the 800lines of code.