Qu-Bot, A Quickly Programmable Robot User’s Manual
Page
46
of
52
8.2. Obstacle avoider
This sample code shows how Qu-Bot can be programmed to make an obstacle
avoider robot.
•
LCD is initialized to show status of robot.
•
The robot starts moving when switch 1 is pressed because there is a while
conditional loop on top.
•
By default robot keeps moving forward at speed 7
•
When front sensor senses obstacle the robot moves backwards for 500 ms and
takes a left turn for 200 ms at speed 10
•
When left or right sensor senses an obstacle the robot stops opposite side motor
to take turn in reverse direction.