from machine import Pin
import time
led = Pin (18,Pin.OUT)
boton = Pin(15,Pin.IN)
def encender_led():
led.on()
def apagar_led:
led.off()
estado=True
while True:
if boton.value()==1:
print ("Botón precionado!")
if estado==True:
time.sleep_ms(200)
encender_led()
estdo=False
else:
time.sleep(1)
apagar_led()
time.sleep(1)
estado=True