3.4 Power Amplifier
3.4.1 Overview
The 8002b power amplifier mainly consists of a speaker and an audio amplification chip. It can amplify small audio signals for about 8.5 times. These amplified sounds will be played through its speaker. Besides, it can also play some music or melodies.
3.4.2 Schematic Diagram

3.4.3 Code Blocks

This block sets tones and durations to emit a certain sound of tone.

This block integrates some songs so that you can directly use.

This block stops the play of tones.
3.4.4 Test Code
3.4.4.1 Build Code
There are two ways to upload the code: directly open the code file we provide; or manually build blocks.
Directly open the code file we provide:
Click
and choose Load from your computer

We have already downloaded the codes on computer desktop, so open the file and choose
3-4-speaker.sb3
Manually build blocks:
In
, find
block.In
, find and place
block under
.

In
, set frequency to NOTE_C4 and duration to 500 in block
.Similarly, add NOTE_D4, NOTE_E4, NOTE_F4, NOTE_G4, NOTE_A4, NOTE_B4
At last add a
.
Complete Test Code

3.4.4.2 Test Result
After uploading code, the power amplifier plays Do, Re, Mi, Fa, So, La, Si, in a loop.
3.4.5 Extension
We make the module to play music.
3.4.5.1 Test Code
There are two ways to upload the code: directly open the code file we provide; or manually build blocks.
Directly open the code file we provide:
Click
and choose Load from your computer

We have already downloaded the codes on computer desktop, so open the file and choose
3-4-speaker2.sb3
Manually build blocks:

3.4.5.2 Test Result
After uploading code, the amplifier plays Birthday Song.