The schematic diagram:
In this experiment, by programming the Raspberry Pi, we make the pin 11 of the
Raspberry Pi output square waves of different frequencies alternately, thus driving the
passive buzzer to play music.
Experimental Procedures
Step 1: Build the circuit
For C language users:
Step 2: Edit and save the code with vim or nano.
U1
p a s s i v e b u z z e r
1K
R2
1
2
3
P1
H e a d e r
LED
220Ω
R1
S
+
-
3
2
1
N P N
8050