​ A relay is an electronic control device, equivalent to a switch.

​ Usually, a relay can be used to control a large current with a small current, or to control a high voltage with a low voltage.

​ By default, NC and COM are on-connected. When the relay works, COM and NC are disconnected, and then NO is connected to COM on-connected, it is like a switch.

​ We connect D1 LED to NO , turn on and off the relay per second to make D1 on and off .

​ Shown as following image :

​ Relay(2 of J2) => Relay(7 of U3) => Relay Out (10 of U3) => Relay => NO /NC

main.py

from machine import Pin
import time

beep = Pin(25, Pin.OUT)
if __name__ == '__main__':
  i = 0
  while True:
    i = not i
    relay.value(i)
    time.sleep(1)
Prev post

buzzer

Next post

bluetooth