from machine import Pin
from time import sleep
print ("\n ================== Iniciando ==================\n ")
led = Pin(18,Pin.OUT)
botao = Pin(5,Pin.IN, Pin.PULL_UP)
botao2 = Pin(4,Pin.IN, Pin.PULL_UP)
while True:
valor_botao = botao.value()
valor_botao2 = botao2.value()
valor_led = led.value()
if valor_botao == 0:
led.value(1)
print("Led Ligado")
while (botao.value() == 0):
sleep (0.2)
if valor_botao2 == 0:
led.value(0)
print("Led Desligado")
while(botao2.value() == 0):
sleep (0.2)
sleep(0.2)