Programming
Bump Around Walls for Touch Sensor
Challenge Program the robot using a Touch Sensor.
Rules 1. Robot must start behind the start line. 2. Robot must use a Touch Sensor to travel around the circle. 3. Robot must end at home base. 1. Place your pseudocode here. If you need more room, use the back of this paper. 2. Draw your flowchart on the back of this paper.
Starting Line
Home Base
NAME
DATE
6.47
©2005 Robomatter Inc. RE 2.5_RW 1.1
Programming Teacher
Bump Around / Flowchart Flowchart Start
Forward
Forward
No
No
TS = 1
TS = 1
Yes
Yes
Stop robot
Stop robot
Reverse for time
Reverse for time
Stop robot
Stop robot
Turn 90 degrees
Turn 90 degrees
Forward for time
LEGEND
Stop robot
Forward Motor A forward, Motor C forward TS = 1 Touch Sensor is pressed Stop robot Motor A off, Motor C off Reverse Motor A reverse, Motor C reverse Turn 90 degrees Motor A reverse, Motor C forward Forward (reverse) for time After clearing and starting the timer, robot goes forward (or reverse) until timer exceeds the necessary time.
©2005 Robomatter Inc. RE 2.5_RW 1.1
End
Note: The purpose of “Reverse for Time” is so that the Touch Sensor button will clear the wall when the robot turns.
6.48
Teacher Programming
Bump Around / Pseudocode Pseudocode • • • • • • • •
Move forward until the Touch Sensor is pressed. Once the Touch Sensor is pressed, back up to give the robot room to turn. Have the robot make a 90 degree turn. Avoid hitting the center obstacle. Move forward until the Touch Sensor is pressed. Once the Touch Sensor is pressed, back up to give the robot room to turn. Have the robot make a 90 degree turn. Avoid hitting the center obstacle. Move forward until the robot is inside the home base. Stop all motors.
6.49
©2005 Robomatter Inc. RE 2.5_RW 1.1