Hello,
I have an LED in a stored state (LED_state[0]), an LDR connected to A2.
I am trying to get it so that when the Checkbox is Checked and the LDR reading goes down to 500 the LED turns ON (When it goes to 600 it turns OFF).
But if the box is Unchecked it will not turn ON.
This is the base code:
if (StrContains(HTTP_req, "LED1=1")) {
LED_state[0] = 1; // save LED state
digitalWrite(2, HIGH);
}
cl.print("<LED>");
if (LED_state[0]) {
cl.print("checked");
}
else {
cl.print("unchecked");
}
cl.println("</LED>");
I have tried all types of combinations including &&, || and even changing the values of the Analog input so it 'blocks'/give a NULL reading (To turn it 'OFF', was a 'swing-in-the-dark' hah).
If someone could Please help I would be Very Grateful ![]()