Users Manual

CLASS 4
72
TORI Piano coding activity
TORI piano sound play
TORI Piano playback coding
Before making TORI Piano mentioned above, we need to make a program without the recording function that
sounds out Do Re Mi Fa So La Ti when the button sensor between 1~7 on the piano is pressed.
Let’s make a script by dragging in the blocks like the one shown above.
The first block means that the script will be executed when the flag icon is clicked on the scratch screen, and the
‘infinite loop’ (of ‘infinite repeat’) block underneath it means that we will continue to check the script in this block
indefinitely.
Inside the ‘infinite loop’ block there is ‘If~’ block. This block activates the script when certain condition is satisfied.
The condition that has to be satisfied in this case is ‘value of analog sensor <100’. This means that is the value of
the analog sensor is less than 100 (when button sensor is pressed) the script inside will be activated.
In conclusion, the script above says, “After you press the flag icon on the screen, when the button sensor on
analog port 0 is pressed, you will hear the 60th note (warm up) at 0.5 beat,” and continue to check the button
sensor value it will be.