from machine import Pin
import utime
# Khai báo chân GP18 là đầu ra
relay = Pin(18, Pin.OUT)
print("He thong bat dau chay...")
while True:
# Bật Relay
print("Trang thai: MO")
relay.value(1)
utime.sleep(2) # Nghỉ 2 giây
# Tắt Relay
print("Trang thai: DONG")
relay.value(0)
utime.sleep(2) # Nghỉ 2 giây