int confirmation;
int status;
unsigned long time1;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
pinMode(25, INPUT_PULLDOWN);
pinMode(26, OUTPUT);
analogReadResolution (10);
}
void loop() {
// pokud se dioda zapne, pin 25 HIGH, tady se klima vypne, pokud není confirmation 1,
// což napoprvé nebude
if (digitalRead(25) == 1) {
if (confirmation == 1) {
// do nothing
}
else {
digitalWrite((26), HIGH);
delay(200);
digitalWrite((26), LOW);
Serial.println("AC OFF");
time1 = millis() + 2000;
}
}
if (time1 > millis()) {
if (digitalRead(25) == 1) {
confirmation = 1;
}
}
}