Buzzer
Overview
Active buzzer, operates on high level, stops on low level.
Technical Specifications
Operating voltage: VCC 3.3V -5V
Module dimensions: 24*48mm
Mounting: 2 plastic building block compatible through-holes
Control method: Digital input
Pin Definition
Pin |
Definition |
|---|---|
GND |
Ground |
VCC |
Power |
DI |
Digital input |
NC |
Not connected |
Example Code
Press the A button for the buzzer to sound, press the B button to stop.
from mpython import *
p0 = MPythonPin(0, PinMode.OUT)
def on_button_a_pressed(_):
p0.write_digital(1)
button_a.event_pressed = on_button_a_pressed
def on_button_b_pressed(_):
p0.write_digital(0)
button_b.event_pressed = on_button_b_pressed