from machine import Pin 
from time import sleep_ms  

LED = Pin(25, Pin.OUT) 
KEY = Pin(21, Pin.IN) 
while 1:
    LED.value(0)  # led.on()  # 灯亮
    sleep_ms(500)  # 等待 500 毫秒
    LED.value(1)  # led.off()  # 灯灭
    sleep_ms(500)

    print(KEY.value())