from machine import Pin
from time import sleep
button = Pin(5, Pin.IN, Pin.PULL_UP)
while True:
button_state = button.value()
if button_state == 0:
print("Button pressed!")
else:
print("Button not pressed.")
sleep(0.5)