diff --git a/src/main.cpp b/src/main.cpp index ad91fa5..49457d4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -49,6 +49,8 @@ void setup() { pinMode(BUTTON_PIN, INPUT_PULLUP); pinMode(LED_PIN, OUTPUT); + + randomSeed(analogRead(0)); } // Wait for button press @@ -56,10 +58,10 @@ void loop() { mqttClient.loop(); int buttonState = digitalRead(BUTTON_PIN); - if (buttonState != lastButtonState && buttonState == LOW) { + if (buttonState == LOW) { digitalWrite(LED_PIN, HIGH); buttonPress(); - delay(100); + delay(3000); digitalWrite(LED_PIN, LOW); } lastButtonState = buttonState;