from machine import Pin
from utime import sleep
led = Pin(5, Pin.OUT)
sw=Pin(4,Pin.IN)
count = 0
while True:
print(sw.value())
if sw.value() == 0:
count+=1
if count % 2 == 1:
led.on()
else:
led.off()
sleep(0.5)