1

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

2

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
1
  • 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. Commented Jul 28, 2016 at 19:46

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.