buzzer
carte BBC micro:bit
Utilisation du buzzer

Schéma du montage (exemple).

code Python (exemple)

from microbit import *
from utime import sleep_us
# This example requires a speaker/buzzer/headphones connected to P0 and GND.
 
def note(duree):
    for i in range(10*duree):
        pin0.write_digital(1)
        sleep_us(1136)
        pin0.write_digital(0)
        sleep_us(1136)
 
while True:
    note(100)	

CC BY SA  ( Christophe Béasse - Mai 2019 )