import time
import board
import digitalio
# Assign Pin to IO.
led = digitalio.DigitalInOut(board.GP26)
button = digitalio.DigitalInOut(board.GP27)
# Declare led object as output
led.direction = digitalio.Direction.OUTPUT
# Set up button object as input with a pull-down resistor
button.direction = digitalio.Direction.INPUT
button.pull = digitalio.Pull.DOWN
while True:
# Read the state of the button
state = button.value
# Turn on the LED if the button is pressed, otherwise turn it off
if state == True:
led.value = True
else:
led.value = False