#on board LED
#write a micropython script to control the onboard led using the onboard switch
#in esp32 board.
#it means whenever we will tap the button named 'boot' - the on board blue led
#will be on
from machine import Pin
from time import sleep
led = 2; #blue led has default position pin no 2
button = 0; #gpio 0 is the default pin no of this button.
board_led = Pin(led, Pin.OUT)
board_button = Pin(button, Pin.IN) #once we have to use the pull up resistor in case of hardware.
while True:
if board_button.value() == 1:
board_led.on()
else:
board_led.off()
sleep(1)