from machine import Pin
import time
red = Pin(15, Pin.OUT)
green = Pin(1, Pin.OUT)
yellow = Pin(2, Pin.OUT)
buttonstop = Pin(14, Pin.IN, Pin.PULL_DOWN)
buttonstart = Pin(13, Pin.IN, Pin.PULL_DOWN)
print("Setup is done")
while True:
Button1 = buttonstop.value()
Button2 = buttonstart.value()
if Button1 == 1:
red.value(1)
time.sleep(5)
red.value(0)
print("stop completed")
elif Button2 == 1:
green.value(1)
time.sleep(5)
green.value(0)
yellow.value(1)
time.sleep(5)
yellow.value(0)
red.value(1)
time.sleep(5)
red.value(0)
print("Start completed")
else:
green.value(1)
time.sleep(5)
green.value(0)
yellow.value(1)
time.sleep(5)
yellow.value(0)
red.value(1)
time.sleep(5)
red.value(0)
print("No button pressed")
time.sleep(0.1)