mini Piano

mini Piano

Make music with the mini

Easy

30 mins

from 8 years on

In this exercise, we will use the Open Roberta editor. Make sure that you can see this image in the top right-hand corner of your programming environment. You can find the editor on our website at the top of the navigation bar under Programming - Editors.

First steps: The mini Piano

Become a music pro on the mini.

1Loop

Select the following block in the menu under Control and attach it to the Start block to play your code in an endless loop.

2Input via pins

From the Control menu sub-item, take the If - make block and select the Pin pressed? block under Sensors to control the individual pins. Click on 0 in the selection.

3show note name

You can display the note name by inserting the Show Text block from the Action menu. Change Text to Characters to display the individual note names. Now type in the name of your note.

4Play note

To play a sound, insert the play whole note... block from the extended menu under Action and Sound. If you click on the note, a piano keyboard with further notes will open. You can click to select which note is played. You can also specify how long your note should be held.

5Control more pins

To assign a note to additional pins, repeat steps 02-04 and make the following adjustments in sequence.

  1. change P0 to P1 etc.
  2. adjust the note name.
  3. select the appropriate note.
  4. change the note length.
6Play piano

Done - download your script now and try it out!

Important!
For the pins to work as input, a circuit must always be closed. Therefore, whenever you touch a pin to play a sound, you must touch the pin with the minus with your other hand.