from machine import Pin
import time
print("Hello, ESP32!")
#Define GPIO PIN
led_red= Pin(22, Pin.OUT)
switch_pin=Pin(13,Pin.IN)
#initial state
led_red.off()
while True:
#switch on
if switch_pin.value()==1:
led_red.on()
#switch off
else:
led_red.off()
#Delay for short period
time.sleep(0.1)