Make a Music Machine with ElecFreaks Micro:bit Tinker Kit
• Get to know the ADKeypad.
• Make something with ADKeypad.
• Make something with Buzzer.
1 x BBC Micro:bit Board
1 x Micro USB cable
1 x ElecFreaks Micro:bit Breakout Board
1 x Octopus Passive buzzer Brick
1 x Octopus ADKeypad
Tips: If you want all components above, you may need ElecFreaks Micro:bit Tinker Kit.
Step 1 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 2 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 3 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.
Input “Tinker” in the search box and then choose “tinkercademy-tinker-kit” to add this package. 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 4 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.
Relative Readings: Make an Intruder Detection with Micro:bit [ElecFreaks] Make a Fish Feeder by Micro:bit Plant Humidity Monitor Make A Burglar Alarm Device with Micro:bit Make A Motion Detector with Micro:bit and Elecfreaks Octopus Kits Use ElecFreaks Micro:bit Tinker Kit to Make A Smart Light
Note: This article is from Tinkercademy “Make a Music Machine” .
If you want to read the latest elecfreaks, please like our Facebook PAGE.