while

Until you have learnt this, keep on reading

This time, it´s the while Control block… With this block, while one condition is being met, other instructions are executed.

Let´s get on it!

You will need:

  • 1 x ZumBloq LDR
  • 1 x ZumBloq buzzer
  • A ZUM BT 328 controller board or one compatible with Arduino UNO
  • A USB cable

This block works in a very simple way, as we will see using an example:

In this program, while the light sensor is being read at over 400, the buzzer will sound. It´s an excessive light alarm! It usually works as shown in this diagram:
while

It´s very important to note that the quantity of light must be updated with every iteration of the loop. Otherwise when we enter the loop, we won´t be able to read the value of the sensor again, so we would never break out of it.