from machine import Pin
from time import sleep_ms,ticks_ms
led=Pin(25,Pin.OUT)
switch=Pin(4,Pin.IN,Pin.PULL_UP)
while True:
switch_value=switch.value()
if switch_value == 0:
led.on()
print("switch value = ",switch_value,ticks_ms())
sleep_ms(10)
else:
led.off()
print("switch value = ",switch_value)