Users Manual

CLASS 4
76
TORI Piano coding activity
Activating TORI Piano
TORI Piano Activation Coding
First, let’s make a code that is activated when the IR sensor connected to Digital Port 3 is pressed. The early sen-
sor value of Digital Port is “false”. When the user presses the infrared sensor, the sensor value changes to "true."
Using this, code “if Digital sensor 3 value = true , then activate the game” .
Drag the blocks in the picture above and make the script.
The first block means that if you click on the flag icon in the scratch screen, the script will be activated. And the
‘infinite loop’ block connected to it below means that it will repeat the script inside this block continuously.
Inside the ‘infinite loop’ block, there is no ‘waiting’ block. This block waits until the certain situation is met. The
condition in this case will be “the value of digital sensor 3 = true.” In other words, if the value of the digital 3 sensor
becomes true, then when the infrared sensor of digital port 3 is pressed, it exits this block and executes the next
command. If so, the above code would say, "if the flag icon is pressed, system will wait for the infrared sensor
connected to Digital Port 3 to be pressed."