​ There are two kinds of buzzer , active buzzer and passive buzzer .

​ We need to connect GPIO25 to BEEP of J2 .and J2 connect to ULN2003D module .

​ GPIO25 –> BEEP(J2) –>BEEP(6,ULN2003D) –>BEEP OUT (11,ULN2003D)–>(BEEP OUT)buzzer

​ main.py

from machine import Pin
import time

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

light one led

Next post

relay