Hi Everyone,
I am writing a program with 2 alarms to control some LED lights, when I set the alarm i can also change the duration of the LED lights,
So the problem is every time I change the duration of one of the alarms it uses the duration in the other alarm,
I have tried all different way to fix this problem but still I can't work this out.
I can post the whole code but I think the problem is in a few lines of the code.
Thanks
if (alarmSet)
{
if (alarmHours == lastHour && alarmMinutes == lastMinute)
{
digitalWrite(backLight, LOW);
Serial.print("CrossFade1");
CrossFade1();
digitalWrite(backLight, HIGH);
}
else if (alarmSet1)
{
if (alarmHours1 == lastHour && alarmMinutes1 == lastMinute)
{
digitalWrite(backLight, LOW);
Serial.print("CrossFade2");
CrossFade2();
digitalWrite(backLight, HIGH);
}
}
}
if (CrossFade1)
{
delay((durationHour*60 + durationMinutes)*6.6);
}
else if (CrossFade2)
{
delay((durationHour1*60 + durationMinutes1)*4.4);
}
Circadian_Light_Control_Box_v1.1.ino (32.2 KB)