from machine import Pin
import time
Led1=Pin(5, Pin.OUT)
Led2=Pin(18, Pin.OUT)
Led3=Pin(19, Pin.OUT)
Led4=Pin(21, Pin.OUT)
Leds=[Led1,Led2,Led3, Led4]
def conversion(num):
return int(num[0])*2**3+int(num[1])*2**2+int(num[2])*2**1+int(num[3])*2**0
while True:
numero=input("Ingrese numero binario del 0 al 15: ")
for i in range(len(numero)):
if numero[i]=="1": Leds[i].on()
else: Leds[i].off()
print(conversion(numero))