Discussion Questions
CONDITIONAL LOGIC WITH IF/ELSE
What is Logic and what does Conditional Logic mean? Logic is determining if something is true based on evidence. Conditional logic is checking if a condition is true or false. In programming, think of it as checking on the 'truthiness' or 'falseness' of an if statement. You can read an if statement as, "Is surface color equal to blue true? If it is true, run the code. If it is false, skip the code.
What is the difference between if and else if? If is always the first check, and else if is every other check. They all need a specific condition to check for truthiness. They cannot be blank.
What is else? Else means that if all if conditions are false, do this code. If you never program else, then the computer understands that it should do nothing, which is often useful.
BOOLEAN OPERATORS
Why would you use AND? Why would you use OR? AND is when you want two conditions to happen at the same time. OR is when you don't care which condition is true, and they both could be.
Describe the difference: "if front left sensor AND front right sensor' vs 'if front left sensor OR front right sensor'. The first conditional check means they both must be true for the code to run. The second one means either one can be true and the code will run.
INFRARED SENSORS
How do these sensors detect distance? Ozobot sends out invisible infrared light from each sensor array and also looks for infrared light in that array. Ozobot knows something is close when it gets a lot of infrared rays bouncing back and the object is far when there are only a few rays returning.
Do a quick experiment with the proximity sensors using this program: https://ozo.bot/b/z6afwv. Run the program and then starting from about 8 inches away, move your hand (or another object) slowly closer to the left front proximity sensor. Ozobot's LEDs should change color. Adjust the settings in the program and hypothesize about how Ozobot will react.