//simple button input_pullup
int button1 = 4;
void setup()
{
Serial.begin(9600);
pinMode(button1, INPUT_PULLUP);
}
void loop()
{
byte buttonState = digitalRead(button1);
if(buttonState == LOW){
Serial.println("Button is pressed");
}
else{
Serial.println("Button is not pressed");
}
delay(100);
}