Working with Touch Sensors
In this activity you will build a new robot and learn how to program it to get information from a touch sensor.
|
|
|
The RCX must be programmed to get information from the touch sensor.
A close look at the touch sensor
The touch sensor has a small pushbutton built into a 2 X 3 brick. Notice that only 4 out of the 6 studs on top of the sensor have wires in them. It is important to have the connector wire attached to all four wired silver pegs. If you do so, you won’t need to worry about the direction you attach the connector wire. Any direction will work.
Like all other sensors, touch sensors attach to input ports 1, 2 or 3 on the RCX.
Problem: You want Roverbot to keep moving forward and to stop when you press the touch sensor.
There are several ways to program the RCX to get touch information. Here is a simple problem, solved two ways.
|
|
|
Thinking about it
Think about Roverbot’s behavior. What did it do when you pressed the touch sensor?
It looks like it’s doing the same thing when you press the touch sensor once. What happened in each program when you pressed it the second time? Try it again if you need to.
How is Wait Until different from Sensor Watcher?
Do not take Roverbot apart. You will need it for the next activity.