Users Manual
CLASS 3
76
Using ‘IF’ syntax
If you had previously controlled the digital output with the 'if & if' statement, Take control of the digital output
with two phrases. First, when the ultrasonic sensor value is low (when the recognition board is approaching), the
first LED sensor should be off. Create a script
The above script will turn off the LED sensor connected to the digital 10 port when the ultrasonic sensor value is
less than '15'. Now, when the ultrasonic sensor value is greater than '15', you have to turn on the LED sensor of
digital 10 port. Please create the script below.
We created a script when the analog reference value is '15' above. When the remaining baseline values are '20'
and '25', you can make the scripts the same. If analog reference value is '20', digital output 11 should be turned
off and on. If analog reference value is '25', digital output 12 should be turned off and on. Once you've created
each script, you can create a loop that will continue to check the condition with an 'infinite loop' block
In the previous level, we have practiced how to make the 'if & not' syntax into the 'if' syntax through many
examples. If you understand the terms of the 'if & not' or 'if' statements, then there is no problem in interpreting
these two statements the same way. Be sure to always put the condition in the phrase carefully.
“IF” syntax utilization