1
Banana Keyboard Workshop
Materials
micro:bit, battery holder and 2 AAA batteries
Banana
Orange
4 Crocodile clips
Steps
Step 1 Connect the ground lead
Using the 1st crocodile clip, connect the end of the crocodile clip onto GND pin of the micro:bit.
2
Step 2 Connect the sound lead
Using the 2nd crocodile clip, connect the end of the crocodile clip onto pin 0 of the micro:bit.
Step 3 Connect the headphone to ground
Using the 1st crocodile clip, connect the second end of the crocodile clip onto based of the
headphone jack
3
Step 4 Connect the headphone sound contact
Using the 3rd crocodile clip, connect the end of the crocodile clip onto the 1st crocodile clip
already clipped onto GND.
Step 5 Connect a fruit lead
Using the 3rd crocodile clip, connect the end of the crocodile clip onto the 1st crocodile clip
already clipped onto GND.
4
Step 6 Connect the orange to ground
Using the 3rd crocodile clip, connect the unattached end of the crocodile clip onto the orange.
Step 7 Connect a second fruit lead
Using the 4th crocodile clip, connect the end of the crocodile clip onto pin 1 on the micro:bit.
5
Step 8 Connect the banana
Using the 4th crocodile clip, connect the unattached end of the crocodile clip onto the banana.
Step 9 Complete banana keyboard
Your banana keyboard is ready!
6
Step 10 Test the keyboard
Start Code
1). Start by adding a variable to store a musical note. Rename the variable to sound. Set the
value of the variable to the note block Middle A from the Music drawe
2). We want to play music when the fruit connected to a pin pressed. So, we register an
event handler that executes whenever pin 1 is pressed. Pin 1 is, of course, connected to the
banana. Add a on pin pressed block from the Input drawer.
3). Now, let’s create some notes to play when the banana is pressed. Click on the Loops
drawer then insert a repeat loop into the on pin pressed block. Click on the Variables drawer
and pull out a change item by block and put it into the loop. Rename the variable to sound.
Change the value from 1 to 25. This will increase the variable sound from the note frequency
of block Middle A to Middle A plus 25 and so on. Put a set to block for sound right after the
loop. Set it to Middle A a in order to reset the sound after a banana press.
7
4). Finally, insert a play tone above the change by. Pull out the sound variable block and drop
it in the note slot of play tone. Change the beat fraction from 1 to ¼
Click Download and try a banana press. Did you hear 4 notes play?