Function of the Module
Equipment
- Other Hardware Equipment
- One USB cable
- One sensor cable
Experiment 1: Buzzer Makes a Sound
Overall
The buzzer here we use is passive, which needs a certain frequency to drive. High voltage can't get it alarmed.
Hardware Buildup
Setup 1:Connect the interface on the back of the buzzer with the D6 port of the Hub.
Setup 2:Connect the CoreUSB, Hub and Buzzer together to the computer with a USB cable.
Mixly Programming
- Step1:Open Mixly software. Drag "Buzzer Open" under "Executer" to the editing area.
- Step2:"Buzzer Open" module description. Pin 6 is connected on the hardware by default, so you don't have to change it.
- After programming graphically, the buzzer only needs "Buzzer Open" to make a sound.
- Description for other Buzzer items.
Debugging
- Step1:Select the right board card(Core USB 32U4) and COM port(Recognized automatically by default).
- Step2:You can hear the buzzer after uploading successfully. Change the frequency of the buzzer Upload again to see what happens.
- The steps above are based on debugging on the computer. The code is inside the core module after uploading, which can also be powered by battery box.
Example 2: Buzzer Gives an Alarm
Overview
To make the buzzer give an alarm.
Hardware Buildup
Same with【Experiment 1: Buzzer Makes a Sound】.
Mixly Programming
- Adopt "For loop" to change frequency, with which you can change the tone. (The lowest frequency that human ears can hear is about 20Hz and the highest is about 2000Hz. )
- Find "Loop" in "Control" item and drag it to the editing area.
- Instruction for "Loop".
- See syntax description after buildup and you'll find time delay module in "Control".
Debugging
- Step1:Select the right board card(Core USB 32U4) and COM port(Recognized automatically by default).
- Step2:The buzzer will produce different sounds continuously after uploading successfully, achieving the effect of alarming.
Experiment 3: Compose Music with Buzzer
Overall
To use a buzzer instead of an audio speaker to play music and generate sound with different tones.
Hardware Buildup
Same with【Experiment 1: Buzzer Makes a Sound】.
Mixly Programming
Let's firstly get to learn numbered music notation-Note.
- Here we adopt the way of array to play music, which is flexible in programming.
- Drag out "Array" item.
Description for "Array"
- Drag out "Rhythm" from "Variable Extension".
- Put the notes and rhythms in "Array".
Debugging
- Step1:Select the right board card(Core USB 32U4) and COM port(Recognized automatically by default).
- Step2:You can hear the buzzer play birthday music after uploading. Users can change music based this principle.
|