cattledog:
// Sets fan interval
if ( minute >= 0 && minute < 10 )
{
digitalWrite ( RELAY2, HIGH );
}
else
{
digitalWrite ( RELAY2, LOW );
}
if ( minute >= 30 && minute < 35 )
{
digitalWrite ( RELAY2, HIGH );
}
else
{
digitalWrite ( RELAY2, LOW );
}
It's not clear to me why this code did not work as you intended. I'm not sure if you had the correct syntax for reading the RTC, or if the relays were not connected properly or of the correct logic. You could add some serial debug commands to see what the actual value of minute going into our conditional tests. You really do need to break your project into pieces. Can you make the relays operate correctly with digitalWrite() commands? Can you get the correct time from the RTC? Linking the two, or using the time library will not be difficult if you have all the pieces working on their own.
I am not entirely sure why it didn't work either. It has been cause for much frustration.
The clock is reset every time I hook the controller up to my computer and I open the serial monitor so the time is always synchronized. There are no problems displaying time in the serial monitor. If I have the second portion of the timer commented out so that the only thing that reads is the first action of 0-10 minutes the relay operates as it should. It is only when the second line is active that the controller glitches. It will sometimes work for a while and just simply stop writing the pin on, or it just doesn't turn on at all.
Is there a chance that the system is getting caught in a loop of trying to determine if the time is correct for the first or second block?