Presentation is loading. Please wait.

Presentation is loading. Please wait.

Loops with Multiple Sensor Controls

Similar presentations


Presentation on theme: "Loops with Multiple Sensor Controls"— Presentation transcript:

1 Loops with Multiple Sensor Controls

2 Open the basic Line Following Program

3 Modify the program so that the loop ends when the Touch Sensor is pressed or the Ultrasonic Sensor detects an object closer than 25 centimeters away.

4 Set the loop to be controlled by Logic.

5 First Create a loop that is controlled by the Touch Sensor
First Create a loop that is controlled by the Touch Sensor. Drag a yellow Touch Sensor Block into the loop. Wire the Touch Sensor Block’s Yes/No plug to the Loops end block logic plug

6 The Touch Sensor Block is set to watch for the pressed action
The Touch Sensor Block is set to watch for the pressed action. This will send a true check any time the touch sensor is pressed to end the loop. Download and test the program, it should stop following the line when the touch sensor is pressed.

7 Adding a Second Sensor Place an Ultrasonic Block after the Touch Sensor Block.

8 Set the threshold for the Ultrasonic Sensor Block to less than 20 cm.
True on the yes/no plug means the ultrasonic Sensor Block is seeing a value less than 20 centimeters. There is only one plug on the Logic Loop but two sensors to plug in therefore a Logic Block is required.

9 Break the wire into the Logic Loop and rewire it into the A input plug on the Logic Block.

10 Wire the Yes/No on the Ultrasonic Block to the B plug on the Logic Block.

11 Select the Logic Block and set the operator to Or.
If either the Touch Sensor or the Ultrasonic Senor are sending out a true value to A or B the Logic Block will output true. Wire the Logic Block to the Logic Loop plug. The True/False value now controls the loop.

12 If the touch sensor is pressed the Touch Sensor Block will feed a True into the Logic Block. If the Ultrasonic sensor detects something 20 cm away it will feed a True into the Logic Block. The Logic Block will pass on a True if either one of the two sensors is sending it a true. Finally the Logic Loop Endblock is waiting to see a true to end the loop.

13 Download and test the program, it should stop following the line when the Touch sensor is pressed or the Ultrasonic sensor is less than 20 cm away from an object. Place the can midway along the line so that the robots Touch sensor detects the can. Did the robot stop the line following loop? NEXT Place the PVC pipe along the line so that the robot detects the pipe as it follows the line. Did the robot stop the line following loop?


Download ppt "Loops with Multiple Sensor Controls"

Similar presentations


Ads by Google