from machine import Pin # import the pins
import time # import the time delay
SWITCH = Pin(13, Pin.IN) # set pin 13 as input pin object for the switch
RED = Pin(21, Pin.OUT) # set pin 21 as an output pin object for the RED LED
GREEN = Pin(19, Pin.OUT) # set pin 19 as an output pin object for the GREEN LED
BLUE = Pin(18, Pin.OUT) # set pin 18 as an output pin object for the BLUE LED
YELLOW = Pin(5, Pin.OUT) # set pin 5 as an output pin object for the YELLOW LED
while True: # run an infinite loop
if SWITCH.value() == 1: # if the switch is turned on
RED.value(1) # turn on the red LED
GREEN.value(1) # turn on the green LED
BLUE.value(1) # turn on the blue LED
YELLOW.value(0) # turn off the yellow LED
time.sleep(0.5) # delay for half a second
BLUE.value(0) # turn off the blue LED
YELLOW.value(1) # turn on the yellow LED
time.sleep(0.5) # delay for half a second
if SWITCH.value() == 0: # if the switch is turned off
BLUE.value(1) # turn on the blue LED
YELLOW.value(1) # turn on the yellow LED
RED.value(1) # turn on the red LED
GREEN.value(0) # turn off the green LED
time.sleep(0.5) # delay for half a second
RED.value(0) # turn off the red LED
GREEN.value(1) # turn on the green LED
time.sleep(0.5) # delay for half a second