//Turn on a LED with a button
import board
import digitalio
import time
led = digitalio.DigitalInOut(board.GP26) #Asign pin to 26
button = digitalio.DigitalInOut(board.GP27) #Asign button pin to 27
led.direction = digitalio.Direction.OUTPUT #Declare LED as output
button.direction = digitalio.Direction.INPUT #Declare LED as output
button.pull = digitalio.Pull.DOWN #Determine downside of the signal
while True:
state = button.value
if state == True:
led.value = True #LED On
else:
led.value = False #LED Off