some edit

This commit is contained in:
unknown 2020-02-20 18:53:41 +01:00
parent c43b751bd3
commit 8a0f4d1956

View File

@ -13,7 +13,7 @@ int unsuccessfulRounds = 0; //Unsucesful atmpt counter
StaticJsonDocument<250> jsonContent; StaticJsonDocument<250> jsonContent;
bool buttonActive = false; bool buttonActive = false;
int interuptCount = 0; int interuptCount = 0;
int realState = 1; int realState = 0;
int state = 0; int state = 0;
String requestJson = ""; String requestJson = "";
@ -167,13 +167,9 @@ bool checkConnection() {
Serial.print("Waiting for Wi-Fi connection"); Serial.print("Waiting for Wi-Fi connection");
while ( count < 30 ) { while ( count < 30 ) {
if (buttonActive){ if (buttonActive){
if (!realState == 1) { int realStateLocal = digitalRead(SWITCH);
digitalWrite(RELAY, HIGH); digitalWrite(RELAY, realStateLocal);
realState = 1; realState = realStateLocal;
} else if (!realState == 0){
digitalWrite(RELAY, LOW);
realState = 0;
}
EEPROM.write(0, realState); EEPROM.write(0, realState);
EEPROM.commit(); EEPROM.commit();
buttonActive = false; buttonActive = false;