Sie sind auf Seite 1von 3

Programming

Introduction to Touch Sensors

Instructions
Design and program a robot that can complete the course below.

1. Move forward until the robot hits the


first obstacle
Start here

2. Back up and turn 90


1 degrees right
3. Move forward until the robot hits the
2 Stack of books second obstacle
4. Back up and turn 90
degrees right
3
5. Move forward until the robot hits the
third obstacle
6 6. Stop
5 4
Stack of books

Stack of books

Procedure
1. Identify the two main simple behaviors used in this program.
___________________________________________________________________________________________________
___________________________________________________________________________________________________

2. On a separate sheet of paper, draw the flowchart for this program.

Extension Activities
3. Write the ROBOLAB™ Subroutines for each of the simple behaviors in Problem 1.
Draw your solutions in the space below, or on a separate sheet of paper if needed.

4. Write the main program that runs the Subroutines you wrote in Problem 3.
Draw your solutions in the space below, or on a separate piece of paper if needed.

NAME DATE

6.15 ©2005 Robomatter Inc. RE 2.5_RW 1.1


Programming Teacher

Introduction to Touch Sensors / Flowchart

Flowchart
Use these answers to give you a basic understanding of the concept.
Keep in mind that students may come up with different correct answers
to complete the same problem.

Start Forward

Forward No
TS = 1

Yes
No Stop
TS = 1
robot

Yes
Reverse
Stop for time
robot

Stop
Reverse robot
for time

Turn 90
Stop degrees
robot

Turn 90
degrees Forward

No
TS = 1
LEGEND
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 Stop robot
Turn 90 degrees Motor A forward, Motor C reverse

End
©2005 Robomatter Inc. RE 2.5_RW 1.1
6.16
Teacher Programming

Introduction to Touch Sensors / 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.
• Make a 90 degree turn to the right.
• Move forward until the Touch Sensor is pressed.
• Once the Touch Sensor is pressed, back up to give the robot room to turn.
• Make a 90 degree turn to the right.
• Move forward until the Touch Sensor is pressed.
• Stop all motors.

6.17 ©2005 Robomatter Inc. RE 2.5_RW 1.1

Das könnte Ihnen auch gefallen