def loop():
global ButtonCounter, lastDebounceTime
buttonState = Pin(Button).value()
if buttonState == 1 and (time.ticks_ms() - lastDebounceTime) > debounceDelay:
ButtonCounter += 1
lastDebounceTime = time.ticks_ms()
if ButtonCounter == 1:
Pin(Pin1, Pin.OUT).value(1)
time.sleep(1)
Pin(Pin1, Pin.OUT).value(0)
elif ButtonCounter == 2:
Pin(Pin2, Pin.OUT).value(1)
time.sleep(1)
Pin(Pin2, Pin.OUT).value(0)
elif ButtonCounter == 3:
Pin(Pin3, Pin.OUT).value(1)
time.sleep(1)
Pin(Pin3, Pin.OUT).value(0)
elif ButtonCounter == 4:
Pin(Pin1, Pin.OUT).value(1)
Pin(Pin2, Pin.OUT).value(1)
Pin(Pin3, Pin.OUT).value(1)
time.sleep(1)
Pin(Pin1, Pin.OUT).value(0)
Pin(Pin2, Pin.OUT).value(0)
Pin(Pin3, Pin.OUT).value(0)
ButtonCounter = 0