import time
from machine import Pin
from machine import Timer
led = Pin(0, Pin.OUT)
switch = Pin(2, Pin.IN, Pin.PULL_UP)
def print_hello(hello_timer):
print("Hello, Pi Pico W!")
def toggle_led(led_timer):
led.toggle()
def check_switch(switch_timer):
switch_state = switch.value()
print(switch_state)
if switch_state == 1:
led.toggle()
else:
led.off()
hello_timer = Timer(mode=Timer.ONE_SHOT, period=3000, callback=print_hello)
#led_timer = Timer(mode=Timer.PERIODIC, period=3000, callback=toggle_led)
switch_timer = Timer(mode=Timer.PERIODIC, period=2000, callback=check_switch)