I am building a system where I am controlling 2 LED strips using an Arduino Uno, time chip and relay. I have managed to get the lights to turn on and off on 2 separate days at different times. Now I want to add a switch to override the program, turning the lights on, when they are not programmed to. I would also like to add an LED to show when the switch is active.
Here is my code.
#include <DS3231.h>
int Relay = 4;
String today ;
DS3231 rtc(SDA, SCL);
Time t;
void setup() {
Serial.begin(9600);
rtc.begin();
pinMode(Relay, OUTPUT);
digitalWrite(Relay, LOW);
delay (2000);
}
void loop() {
today = rtc.getDOWStr();
if (today == "Thursday") {
if ( 15 > t.hour && t.hour < 22) {
digitalWrite (Relay, HIGH);
}
else{
digitalWrite (Relay, LOW);
}
}
if (today == "Friday") {
if ( 16 > t.hour && t.hour < 23) {
digitalWrite (Relay, HIGH);
}
else{
digitalWrite (Relay, LOW);
}
}
}
How am I best proceeding?