The compare block is an extremely useful tool for logic operations in seemingly simple programmes. It comes with six settings which are:
Equal to
Not equal to (Inverse of equal to)
Greater than
Greater than or not equal to
Less than
Less than or equal to
Basically a compare block allows a robot to make decisions based on the value it obtains, for example:
This programme above measures the current reflected light intensity measured by colour sensor (Port 3) and compares it against a variable, in this case 25, and plays a specific sound. A practical use of this comparison block would be to differentiate two different objects of the same colour.
Comments