# ERGASIA_1
from machine import Pin
import time
print('First Effort')
redLED = Pin(27, Pin.OUT)
redLED(0) # set value low
yellowLED = Pin(26, Pin.OUT)
yellowLED(0) # set value low
greenLED = Pin(25, Pin.OUT)
greenLED(0) # set value low
sw_button = Pin(13, Pin.IN, Pin.PULL_DOWN)
print("Let's get Started")
while True: # repeat forever.
sw_state = sw_button.value()
print(sw_state)
if sw_state == 1:
greenLED.value(1)
yellowLED.value(1)
redLED.value(1)
else:
greenLED.value(0)
yellowLED.value(0)
redLED.value(0)
redLED(0) # Turn off red for green light
yellowLED(0) # turn off yellow
greenLED(1) # turn on green
print("Green Light!")
time.sleep(5) # wait 5 seconds
redLED(0) # turn off red light for yellow light
yellowLED(1) # turn yellow light on
greenLED(0) #turn green light off.
print("Yellow Light")
time.sleep(2) # wait 2 seconds
redLED(1) # turn on Red light
yellowLED(0) # turn off yellow light
greenLED(0) # turn off green lignt
print("Red Light")
time.sleep(5) # wait 5 seconds