PCEval / esp32 /level2 /button_pulldown /src /main_esp.cpp
eunzee's picture
upload Arduino Uno and ESP32 project files
8e53a3e verified
Raw History Blame Contribute Delete
401 Bytes
/**
Manage pull down registor button input
1 APR 2025 by Blind Author
*/
#include <Arduino.h>
const int inputPin = 4;
void setup()
{
Serial.begin(9600);
pinMode(inputPin, INPUT);
}
void loop()
{
int val = digitalRead(inputPin);
if (val == HIGH) {
Serial.println("Button pressed");
} else
{
Serial.println("Button not pressed");
}
delay(1000);
}