Users Manual

SCRATCH CODING KIT
In the 'Monitor_process' script created on the previous page, if the infrared sensor connected to the right
recognizes an obstacle, it broadcasts 'Detect_IR_R' and stores '1' in the variable 'is_Detect_obstacle'.
Now, let's code what the script 'Detect_IR_R' should do. This script shows the situation when the right infrared
sensor is recognized, so the car must go to the left. At this time, instead of going straight to the left, you have to
go back to the left after the sound is heard. Create the scripts below!
If you receive a broadcast called 'Detect_IR_R', broadcast 'Move_BB' and wait for 2 seconds. Then, broadcasts
'Move_FL' and 'Detect_Clear'. I do not know if you've noticed, but here 'Move_BB' is the script that makes the
car sound and run backwards, and 'Move_FL' is the script that drives the car to the left. When the operation is
completed, the 'is_Detect_obstacle' variable is set to '0' through a script called 'Detect_Clear' to recognize the
obstacle again.
The 'Move_FL' script will change the servo motor angle to the left, then move the motor to the left by turning on
the DC motor, then the 'Move_BB' script will change the servo motor angle to the forward direction and will let
the car go back for two seconds.
The 'Detect_Clear' script waits for the car to run for an unobstructed period of 1.5 seconds, then saves
a '0' in the 'is_Detect_obstacle' variable to resume obstacle recognition.
Activities
Operation after judging using right infrared sensor