from machine import Pin
from time import sleep
errado = Pin(21, Pin.OUT)
errado.on()
certo = Pin(22, Pin.OUT)
certo.on()
tentativas = 0
cadastro = '1234'
while True:
if tentativas == 3:
print("Muitas tentativas!\nAguarde 30 segundos")
sleep(30)
tentativas = 0
senha = input("Escreva algo: ")
if senha != cadastro:
tentativas += 1
while True:
errado.off()
sleep(1)
errado.on()
break
if senha == cadastro:
certo.off()
break