// Get Switch State 1 and send HTTP request to HC2
SwitchState_1 = digitalRead(Input1);
if (SwitchState_1 != lastSwitchState_1) {
if (SwitchState_1 == HIGH) {
Input1_OPEN(client); // sents an http request to my home automation telling sensor = open
}
else {
Input1_CLOSED(client); // sents an http request to my home automation telling sensor = closed
}
}
lastSwitchState_1 = SwitchState_1;
In another arduino uno (just for a test) it works wereby the LED goes on/off. When i add this to the sketch for the arduino nano in a http request server (webserver) without webpage. connection is closed. so it waits until i got a incoming http request to switch one of the 4 relays, which are connected to the arduino nano too (4 inputs and 4 outputs) at that time it sent the input change to the home automation.
But that's not my purpose. my input needs to sent a http request any time it changes status, high or low. and should not wait till I got an incoming http request to switch one of the relays.