import board
import digitalio
import time
greenLED = digitalio.DigitalInOut(board.GP26) # yellow
greenLED.direction = digitalio.Direction.OUTPUT
redLED = digitalio.DigitalInOut(board.GP0) # red
redLED.direction = digitalio.Direction.OUTPUT
yellowLED = digitalio.DigitalInOut(board.GP1) # green
yellowLED.direction = digitalio.Direction.OUTPUT
button = digitalio.DigitalInOut(board.GP27)
button.direction = digitalio.Direction.INPUT
button.pull = digitalio.Pull.DOWN
while True:
state = button.value
if state == True: # Establish a condition to light up all LEDs
when the button will press
greenLED.value = True
redLED.value = True
yellowLED.value = True
else: # Establish a condition to light up only one LED
greenLED.value = True # Set LED to turn on
redLED.value = False # Set LED to turn down
yellowLED.value = False # Set LED to turn down
time.sleep(1)
redLED.value = True # Set LED to turn on
greenLED.value = False # Set LED to turn down
yellowLED.value = False # Set LED to turn down
time.sleep(1)
yellowLED.value = True # Set LED to turn on
greenLED.value = False # Set LED to turn down
redLED.value = False # Set LED to turn down
time.sleep(1)
C I R C U I T P Y T H O N