Users Manual

CLASS 3
120
Enter the Tori Secret Safe Number
Now let's learn coding using the button sensor and the infrared sensor to enter the number. We'll add the
number to the 'Code' list when we press the button sensor once.
Make a script like the one above
First, use the 'if' block. It is a block that executes an internal script when certain conditions are met. The condition
here is the value of the analog 0 sensor <90. There are four button sensors connected to the current input analog
ports 0 ~ 3. Here we will create a script for the button sensor plugged into the input analog port 0. The button
sensor has a smaller value when pressed. 'Analog 0 sensor value <90' can be satisfied when the button sensor
connected to input analog port 0 is pressed. In other words, if the value of analogue 0 sensor is <90, the meaning
of the block is 'if the button sensor connected to input analogue port 0 is pressed'.
If this condition is satisfied, add '1' to the 'Code' list. At this time, if the analog 0 button sensor is still pressed, it
will add '1' to 'Code' list, so we use 'Wait' block. This block is a block waiting for a certain condition. If the user
presses the analog 0 button sensor, it will wait until it is released before proceeding to the next script. At this time,
the condition will be 'Analog 0 sensor value> 90'. That is, if the value of the analog 0 sensor is less than 90 (if the
button sensor is pressed), add 1 to the Code list and wait until the value of the analog 0 sensor is greater than 90
(until the button sensor is released).
Activity