from machine import Pin led = Pin(14, Pin.OUT) led.value(1)
from machine import Pin button = Pin(13, Pin.IN) while True: if button.value() == 1: print("Button pressed")This code initializes pin 13 as an input and continuously reads its value. If the value is 1 (the button is pressed), it prints a message to the console. Package/Library: machine