Hello 2 days trying to get my timer widget working with automatic On OFF button.
Can some one take a look what i’m doing wrong?
BLYNK_WRITE(V8) // LED LAMP RELAY ON / OFF By timer
{
lightrelay = param.asInt();
ledcontrol();
Serial.print(lightrelay);
}
BLYNK_WRITE(V9) // LED LIGHT AUTOMATIC ON/ OFF
{
lightauto = param.asInt();
ledcontrol();
Serial.print(lightauto);
}
void ledcontrol() {
Serial.print("BUTTON");
Serial.println(lightauto);
Serial.print("TIMER");
Serial.println(lightrelay);
Blynk.virtualWrite(V12, lightauto);
Blynk.virtualWrite(V13, lightrelay);
if (lightrelay == 1) {
if (lightauto == 1) {
digitalWrite(52, HIGH);
}
} else {
digitalWrite(52, LOW);
}
}
i was tying also to replace with this… not working
if ((lightrelay == 1) && (lightauto = 1))
Im switching Auto lights from ON to Off and my relay doesn't go off values are button changing from 1 to 0 and timer widget stay at 0 (when times in in non working time set)
Then i set timer and test when it was in time value was 1 when timer finishes value was 0 , but relay was still on,
Update: Working now i changed \
if (lightrelay == 1) {
if (lightauto == 1) {
digitalWrite(52, LOW);
}
} else {
digitalWrite(52, HIGH);
}
}
but my problem is when timer is activated like for 5 mins but i want to stop relay with button like for 10 secs and again pressing button continue relay on with timer left