Setting time on RTC 1307 - Binary lilypad clock

danielNC:
I have been playing with the Binary Clock featured in the Evil Genius book.

Had a problem with running too slow so I attached a RTC to A4 and A5 for time reading.

I would like the time adjust button (moved from pin 18 to pin 11) to step the minutes forward and reset the seconds to 0 and then set this as the new time in the RTC. I cannot get this to work. I also added in a serial printout so I can view the time while plugged in. Below is my coding... Any suggestion on setting time forward, resetting seconds, and writing to RTC?

void loop()                     

{
  if (digitalRead(switchPin))
  {
    //RTC.set(time_t);
    //adjustTime(60);
    // delay(100);

//second() == 0;
    //spin(hour());
    //setTime(t)
  }

Of course it won't work if you comment out all the code! :slight_smile:

I think the problem is that you tell the RTC library to set the time first and THEN change the time. Perhaps it would work if you changed the time and THEN set the RTC:

  {
    adjustTime(60-second());  // Move the clock forward to the next minute    
    RTC.set(now());  // Set the RTC to the new time
  }