from machine import Pin
from utime import*
t=0.02
led1 = Pin(0,Pin.OUT)
led2 = Pin(1,Pin.OUT)
led3 = Pin(2,Pin.OUT)
led4 = Pin(3,Pin.OUT)
led5 = Pin(4,Pin.OUT)
p1=Pin(16,Pin.IN,Pin.PULL_DOWN)
p2=Pin(17,Pin.IN,Pin.PULL_DOWN)
p3=Pin(18,Pin.IN,Pin.PULL_DOWN)
p4=Pin(19,Pin.IN,Pin.PULL_DOWN)
p5=Pin(20,Pin.IN,Pin.PULL_DOWN)
while True:
if p1.value()==1:
led1.toggle()
sleep(t)
elif p2.value()==1:
led2.toggle()
sleep(t)
elif p3.value()==1:
led3.toggle()
sleep(t)
elif p4.value()==1:
led4.toggle()
sleep(t)
elif p5.value()==1:
led5.toggle()
sleep(t)
'''
while True:
if Condición 1:
código para la condición 1
elif Condición 2:
código para la condición 2
elif Condicion 3:
código para la condición 3
elif Condición n:
código para la condición n
else:
código para una condicion especifica
'''