from machine import Pin
import time
# Define the GPIO pin connected to the relay's IN pin
relay = Pin(2, Pin.OUT) # Replace 10 with your actual GPIO number
while True:
relay.value(1) # Turn ON relay (usually closes the circuit)
print("Relay ON")
time.sleep(0.5)
relay.value(0) # Turn OFF relay (opens the circuit)
print("Relay OFF")
time.sleep(0.5)