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.

What you will need:

The Robotics Inventionô Kit

Constructopedia, pages 12-17

A disk to save your work

A copy of the Technical Guide

Building Bin

                                                                                                                                   

 

What to do:

  1. Build Roverbot: Follow the direction in the Constructopedia,   pages 12 to 17.

  2. Using a long connector wire, attach a touch sensor to Port #1.

  3. Run Roverbot on program #1

  4. Press the touch sensor.
    What happened? Did it respond to the 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.

 

Tech Guide

 

You can tell Roverbot to

Wait Until the touch sensor is pressed and only then, do what you want it to do. While waiting, Roverbot can do other things.

 


© The LEGO Group

 

1. Recreate this program.

2. Save it on your disk.

3. Download and run it.

 

 

What happens when you press the touch sensor?

 

 

What happens when you press the touch sensor again?

 

Tech Guide

Using Sensor Watcher you can tell Roverbot to watch the touch sensor all the time and to do something different when itís pressed.

 

 

 

 © The LEGO Group

 

 

 

1. Recreate this program.

2. Save it on your disk.

3. Download and run it.

 

 

What happens when you press the touch sensor?

 

 

What happens when you release the touch sensor?

 

 

What happens when you press the touch sensor again?

 

 

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.