Hello,
I am using 4 channel relay (out of which I am using only 3) connected to arduino uno.
I need to control these 3 relays based on RTC.
if the states of those relays is specific and it has to repeat the same states every day,
then its not a problem,i could use this code format( found on the this forum)
#include <TimeAlarms.h> //Changed Number of alarms dtNBR_ALARMS to 30 max 255
void setup()
{
Alarm.alarmRepeat(12,15,0, Feed); // Lunch hh,mm,ss
Alarm.alarmRepeat(8,15,0, LightOn); // Turn on the light
//other alarm events
}
void loop()
{
}
//***********************************************
//Lunch
void Feed()
{
// Put Lunch code here
}
//***********************************************
//Turn on the light
void LightOn()
{
// Put LightOn code here
}
//***********************************************
but, the state of relays changes at different time for every alternative days.
for example,
1st day-- @11:00, relay=on, relay 2=off, relay 3=on.
@11.20, r1 =on,r2=off, r3=off.
@13.20, r1=off,r2=on, r3=on.
2nd day--@11:00, relay=on, relay 2=off, relay 3=on.
--@12:00, r1 =on,r2=off, r3=off.
--@13:00, r1=off,r2=on, r3=on.
3rd day--- same as 1st
4th day--- same as 2nd
and repeats likewise for every alternative days.
how can i write or modify code for the above requirement.
kindly suggest.
Thank you.