from machine import Pin
from time import sleep_ms
# criação dos objetos a serem utilizados:
led = Pin(19,Pin.OUT) #PinMode(19,OUTPUT)
botao = Pin(5, Pin.IN, Pin.PULL_UP)
botaozinho = True
estadoled = False
# while(1==1)
while True:
if (botao.value() != botaozinho): #botao(0) diferente do estado do botao atual que é 1
botaozinho = botao.value() #iguala o estado atua do botao (1) com o valor, identificando que ele esta ligado
if(botaozinho):
estadoled = False
while not botaozinho:
led.value(1) #digitalWrite(19,1)
sleep_ms(500) #equivalente ao delay(500)
led.value(0) #digitalWrite(19,0)
sleep_ms(500) #equivalente ao delay(500)