Introduction: Make a Music Machine With ElecFreaks Micro:bit Tinker Kit
• Get to know the ADKeypad.
• Make something with ADKeypad.
• Make something with Buzzer.
Step 1: Materials
Step 2: Procedure
After connecting one end of the USB cable to your computer, connect the other end to the micro:bit as shown in the picture below.Then connect the side of the micro:bit where the pins are located to the breakout board.
Step 3: Procedure
Plug in the buzzer Brick to Pin 0.
Plug in the ADKeypad to Pin 2.
Make sure the colour of the wire of the buzzer and the ADKeypad follows the colour of the pins on the breakout board.
Step 4: Procedure
Click on Advanced in the Code Drawer to see more code sections.
To code for our extra kit components (the ADKeypad and the buzzer), we have to add a package of code.Look at the bottom of the Code Drawer for "Add Package" and click it. This will open up a dialogue box.Copy and paste this link into "Add Package" text field:
Click on the search icon or press enter.
Then, click on the Tinkercademy button.
Note: If you get a warning telling you some packages will be removed because of incompatibility issues, either follow the prompts or create a new project in the Projects file menu.
Click on Tinkercademy inside the Code Drawer to find our custom blocks for the various components in your kit.
Step 5: Procedure
Next, let's create a conditional statement as shown in the picture. This 'if-then' block of code is under the code section "Logic" of the code drawer.The code shown below means that when button A is pressed on the ADKeypad while the ADKeypad is plugged in at pin P2 of the breakout board, the buzzer will play a sound of 175 hertz.
Since there are 5 buttons, we need to code 5 similar conditional statements. Each button controls a sound of a particular pitch. So press each buttion, we will get sounds of different pitches.
Success! You now have your own Micro:bit Music Machine.
Step 6: Relative Readings:
Note: This article is from Tinkercademy “Make a Music Machine” .
We have a be nice policy.
Please be positive and constructive.