from machine import Pin
from time import sleep
counter = 1;
led1 = Pin(15, Pin.OUT)
led2 = Pin(14, Pin.OUT)
led3 = Pin(13, Pin.OUT)
button = Pin(12, Pin.IN, Pin.PULL_DOWN)
counter = 0;
while True:
if (button.value()):
if (counter == 0):
led1.high()
sleep(0.5)
counter = counter + 1
elif (counter == 1):
led2.high()
sleep(0.5)
counter = counter + 1
elif (counter == 2):
led3.high()
sleep(0.5)
counter = counter + 1
elif (counter == 3):
led1.low()
led2.low()
led3.low()
sleep(0.5)
counter = 0
# state = 0
# while True:
# if (button.value() == 1):
# state += 1
# sleep(1)
# if(state == 1):
# led1.high()
# led2.low()
# led3.low()
# if(state == 2):
# led1.high()
# led2.high()
# led3.low()
# if(state == 3):
# led1.high()
# led2.high()
# led3.high()
# if(state == 4):
# led1.low()
# led2.low()
# led3.low()
# state = 0