Touch and Go!
Remember the program you wrote telling M. Pathfinder to go to a wall and come back. In your solution, you had to modify your program each time the distance to the wall changed. In this activity you will use information from a touch sensor (input) to tell a robot to back up each time it hits a wall, no matter how far away from the wall it is placed.
What to do:
- Build a single bumper for your Roverbot: Follow the directions in the Constructopedia, pages 26 to 29.
- Look at the bumper you’ve just built. The touch sensor is released (the yellow button is not pushed in). Now, push lightly on the bumper. What happens to the touch sensor?
- Connect the bumper to Roverbot.
Problem: Make Roverbot move forward towards a wall and move back for 3 seconds after it hits the wall. The main idea here is that Roverbot should be able to move forward any distance before it hits a wall.
Here are some blocks that can be used to have the program receive input from a touch sensor. In each of these blocks there’s a question: “Is the touch sensor pressed?”
Wait Until touch (red) Yes & No touch (purple) Sensor Watcher touch (blue)
Tech Guide Tech Guide Tech Guide
© The LEGO Group
- Make Roverbot move until it hits something. Then have it move backwards for a bit, turn a little, and continue to move forward.
- Connect two touch sensors to two long connector wires. Write a program that will let you use the touch sensors as remote controls to “take Roverbot for a walk.”
- Write a program to have Roverbot zigzag as you press and release the touch sensor. (You can use more than one touch sensor if you want to.)
- Build the Table Bumper on page 90 of the Constructopedia. Attach it to Roverbot so that when it’s placed on a table, the wheels touch the table (and the touch sensors are released). Write a program to make Roverbot move on the table and avoid falling off the edge.
Important note: As you try it out, be sure to stand by, prepared to catch Roverbot.
Thinking about it
Look at these two blocks. Both get input from a touch sensor. How are they different from each other?
Do not take Roverbot apart. You will need it for the next activity.