from machine import Pin #Pins from machine
import time #import time for the delay
Switch = Pin(33, Pin.IN) #Defining the Switch as an Input
LED_Red = Pin(5, Pin.OUT) #Defining the Red LED as an Output
LED_Green = Pin(18, Pin.OUT) #Defining the Green LED as an Output
LED_Blue = Pin(19, Pin.OUT) #Defining the Blue LED as an Output
LED_Yellow = Pin(21, Pin.OUT) #Defining the Yellow LED as an Output
while True: #Case loop flow for the program
if Switch.value() == 1: #Setting the switch into value 1 which means at ON state
LED_Red.value(1) #Red LED is ON at steady state
LED_Green.value(1) #Green LED is ON at steady state
LED_Blue.value(1) #Blue LED is ON at this moment
LED_Yellow.value(0) #Yellow LED is OFF at this moment
time.sleep(1) #time delay for the 2 codes above before it change to another state
LED_Blue.value(0) #Blue LED is OFF at this moment
LED_Yellow.value(1) #Yellow LED is ON at this moment
time.sleep(1) #time delay for the 2 codes above before it change to another state
elif Switch.value() == 0: #Setting the switch into value 0 which means at OFF state
LED_Blue.value(1) #Blue LED is ON at steady state
LED_Yellow.value(1) #Yellow LED is ON at steady state
LED_Red.value(1) #Red LED is ON at this moment
LED_Green.value(0) #Green LED is OFF at this moment
time.sleep(1) #time delay for the 2 codes above before it change to another state
LED_Red.value(0) #Red LED is OFF at this moment
LED_Green.value(1) #Green LED is ON at this moment
time.sleep(1) #time delay for the 2 codes above before it change to another state