const int LED_PIN = 4;
const int BTN_PIN = 5;
void setup() {
Serial. begin (115200) ; pinMode (LED_PIN, OUTPUT) ;
pinMode (BTN_PIN, INPUT_PULLUP) ;
}
int saved_value = HIGH;
void loop() {
int value = digitalRead (BTN_PIN) ;
if (saved_value != value) {
Serial.printf("Input value changed: %d\n", value);
saved_value = value;
}
digitalWrite(LED_PIN, !value);
delay (10);
}