from machine import Pin
import time
led = Pin(12,Pin.OUT)
btn = Pin(23,Pin.IN)

while True:
  while btn()==0:
    led.on()
    time.sleep(1)
    led.off()
    time.sleep(1)
  while btn()==1:
    led.on()
    time.sleep(0.1)
    led.off()
    time.sleep(0.1)