Example:how to make games on scratch

Script description
When mBot travels within the surface of the white table (or other light color table), the line-patroling sensor can receive the returned infrared signal and the value is 3 (both Sensor1 and Sensor2 return 1); At the moment that mBot travels to the edge of the table surface, the line-patroling sensor cannot receive the reflected infrared light and the value is 0 (both Sensor1 and Sensor 2 return 0). When the value of the line-patroling sensor is 0, it is deemed to have reached the edge of the table surface and will be stopped. #how to make games on scratch#
Also if you use this program, mBot will stop moving forward when it detects black.
Extended tasks
Task 1 | Modify the script to let mBot move back when it detects a cliff. |
Task 2 | Modify the script and use ![]() |
Attached – Line-patrolling sensor structure diagram
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
# arduino download # coding robots for kids # scratch download # scratch 2.0 # kids programming language # how to make games on scratch # scratch 3.0