Banana Keyboard Workshop
Banana Keyboard Workshop
Banana Keyboard Workshop
Materials
Using the 1st crocodile clip, connect the end of the crocodile clip onto GND pin of the micro:bit.
2
Using the 2nd crocodile clip, connect the end of the crocodile clip onto pin 0 of the micro:bit.
Using the 1st crocodile clip, connect the second end of the crocodile clip onto based of the
headphone jack
3
Using the 3rd crocodile clip, connect the end of the crocodile clip onto the 1st crocodile clip
already clipped onto GND.
Using the 3rd crocodile clip, connect the end of the crocodile clip onto the 1st crocodile clip
already clipped onto GND.
4
Using the 3rd crocodile clip, connect the unattached end of the crocodile clip onto the orange.
Using the 4th crocodile clip, connect the end of the crocodile clip onto pin 1 on the micro:bit.
5
Using the 4th crocodile clip, connect the unattached end of the crocodile clip onto the banana.
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?