#onboard led using on board switch
from machine import Pin
led_pin = 2
switch_pin = 15
led = Pin(led_pin, Pin.OUT)
switch = Pin(switch_pin, Pin.IN, Pin.PULL_UP)
while True:
switch_state = not switch.value()
led.value(switch_state)
#onboard led using on board switch
from machine import Pin
led_pin = 2
switch_pin = 15
led = Pin(led_pin, Pin.OUT)
switch = Pin(switch_pin, Pin.IN, Pin.PULL_UP)
while True:
switch_state = not switch.value()
led.value(switch_state)