Is there a way to express this so that I am only using recalled minutes data to perform an action like this for every hour without writing 24 blocks?
// 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.