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");
  }
2

The alarm is always on because you are setting it to be always on. You code should say:

 if (_server.arg("alarm1") == "on") {
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.
    – linhartr22
    Jul 28 '16 at 19:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.