Ambulance sound

Author: Yisong Xu, Si Xu

Each time you press the onboard button, the onboard buzzer will play a sound of ambulance.

Hardware requirements:

mBot/mCore Control Panel


Upload the program to Arduino

Example program download:

Ambulance sound.sb2


Example programs

Script description

Use this block to determine whether to play the following sound effects according to the on-board button state
Repeat it to ensure the sound effects each time the onboard button is pressed
Directly define the sound of the buzzer according to the frequency and time of a sound

Knowledge points
Point 1 Ambulance sound effects
Ambulance sound effects consist of high frequency and low frequency in two voices, with high frequency sound of 950Hz and low frequency sound of 700Hz. High frequency sound lasts for 0.6 second and low frequency sound 0.4 seconds. High and low frequency sounds are played alternatively.

Point 2 Use of the tone playing block
1) The tone within the tone-playing block is the sound frequency in Hz. You can click a tone to pop up a dropdown box, where you can enter the frequency value to let the buzzer sound. For example, the frequency of C4 is 261.6Hz, so   is equivalent to .
2) The rythem within a tone-playing block is the duration of a sound in ms. You can click a rythem to pop up a dropdown box, where you can enter the duration, for example, 500ms for a one-second rythem, so  is equivalent to .


Extended tasks
Think whether you can replace  in this example with ?

Attached -mCore main control board buzzer and onboard button diagram

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.