Users Manual
SCRATCH CODING KIT
Tori Secret safe basic setting coding
We'll create a script when we receive the broadcast, with the 'Broadcast' block we learned earlier. First, create
a script when you receive the 'StartUp' broadcast. The role of 'when receiving StartUp' script is to set the initial
value of the variable and to set the other operation of the LED sensor whether to open or close the door. Let's go
ahead and make it!
Create a script like the one above. 'Close' is the angle of the servo motor when the door is closed, and 'Open' is
the angle of the servo motor when the door is opened. After setting the initial values of these two variables, try
coding the operation of the LED sensor. The LED sensor will flash every 1 second if the door is closed and stay on
if the door is open. The coding of the operation of the LED sensor will be discussed in detail on the next page.
Do you remember the block that runs the servomotor? Try to assign multiple values to this block (0 ~ 180) and
check the angle when the door is opened and closed. We need to store the value of the Closed variable in the
'Close' variable, and the value of the variable in the 'Open' variable when the statement is opened. Since the angle
of the servomotor you have is different for each product, you need to check the angle. It is very important to check
the figures first because it can cause errors in actual operation!
Activity