print("Hello, ESP32!")
from machine import Pin
from utime import sleep
# Define slide switch pin
Switch = Pin(13, Pin.IN, Pin.PULL_DOWN)
Button = Pin(27, Pin.IN)
Green = Pin(12, Pin.OUT)
Red = Pin(14, Pin.OUT)
while True:
# Read slide switch state
Slide_state = Switch.value()
Push_state = Button.value()
if Push_state:
print("Push Button is ON")
Red.value(1)
# Check switch position
else:
if Slide_state:
print("Slide switch is ON")
Green.value(1)
else:
print("Slide switch is OFF")
Green.value(0)