I am trying to make an arduino alarm clock to which you can send alarm clock times over the web. This is the HTML code
<input type="checkbox" name="alarm1" id="alarm1">1</button>
It's sending the HTTP correctly but the rest of the code insists that the alarms are always on.
if (_server.arg("alarm1") = "on") {
alarm1 = true;
Serial.println("Alarm 1 is set");
}
else {
alarm1 = false;
Serial.println("Alarm 1 is inactive");
}
asked Jul 28, 2016 at 7:02
1 Answer 1
The alarm is always on because you are setting it to be always on. You code should say:
if (_server.arg("alarm1") == "on") {
answered Jul 28, 2016 at 8:02
-
To clarify, one equal sign is used to assign a value to a variable, two equal signs is used to determine if one value equals another.linhartr22– linhartr222016年07月28日 19:46:04 +00:00Commented Jul 28, 2016 at 19:46