Users Manual
CLASS 3
140
Tori Secret Safe Problem 4 Commentary
Let’s make a script for when you receive ‘StartUp’ broadcast.
The role of the 'When received StartUp' script is to set the initial value of the variable, and to set the behavior of
the LED sensor whether the door is open or closed.
Create a script like the one above. The 'keycnt' variable stores the number of digits. The 'index' variable stores
the number entered in the 'Code' list into the 'Key' list. The 'Close' variable stores the angle of the servo motor
when the door is closed, Open 'variable is the angle of the servomotor when the door is opened. Let's set the
initial values of these four variables and then code 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. Please note that the coding of the operation of the
LED sensor is covered in the previous section.
Commentary