"OR" vs "AND"
Change the Logic Operations Block's Mode from "OR" to "AND".The robot wil only stop when the Touch Sensor is pressed AND the Rotation Sensor has passed 5 rotations! |
Mini Challenge 1: Forward until Touch OR Rotations OR Near
In this lesson, you created a custom logic loop that exits if one of two conditions is met.
Upgrade your custom logic loop you created in this lesson to exit
if one of the following 3 conditions is met.
Just like Rotation Sensor Block set to "compare" number of rotations, Ultrasonic Sensor Block can be set to "compare" number of centimeters.
Your first Logic Operations Block determines whether one of "a" or "b" is "Yes"/True". If it is, it will output "Yes/True" from its Output plug. To test for a third condition, where should this output plug should be connected to?
Logic Operations Blocks cannot accept more than 2 logic inputs. However, you can use more than one Logic Operations Block.
Add a second Logic Operations Block that will accept logic output from the first Logic Operations Block as its 'a', and will accept logic value from Ultrasonic Sensor Block as its 'b'.
Mini Challenge 2: Line Track until Touch or Near
You robot can do more than simply moving forward while watching out for multiple stop conditions.Create a line tracking robot that will stop if one of the following two conditions are met:
Keep in mind that line tracking behavior is performed using a loop. Change this loop's mode into "Logic" to create a custom logic loop.
After the robot decides which motor should be used (switch), add Sensor Blocks and Logic Operations Block to complete your custom logic loop