The purpose of the patrol robot is to detect if the doors in a building are open or closed. The robot makes use of all the sensors to do this. It starts out going forward until the light sensor detects a dark line. Then, it waits again until there is light to make sure the robot crosses the line. The robot then turns left and uses a switch block to detect whether the distance is greater or less than 15 cm. If the distance is less, the door is closes and the ultrasonic sensor is detecting the door. If the door is open, the ultrasonic sensor detects the back wall which is greater than 15 cm. If the door is closed, the robot turns right and proceeds to the next black line. If the door is open, it plays an alert sound until the touch sensor is pressed. A loop is placed around all of this to make the robot continue this behavior forever. This saves time because you don't have to re-write the whole program every time you want the robot to repeat these actions. The program shown gives you an idea of the block used.
No comments:
Post a Comment