Get me outta here!

Today we will be learning how to use some of the blocks of the Control tab in bitbloq, namely the break out and continue with next iteration blocks.

The break out block serves to interrupt the execution of a loop.  Imagine that you want a loop to carry out an action 100 times, for example, turning an LED on and off while the buzzer sounds. However, you want it to stop flashing on and off or buzzing when the button is pressed (because all that noise and blinking is tiring). So how do we go about doing this? With the break out and continue blocks. When you use this block within a loop, you automatically leave it (break out), or you skip to the next iteration without finishing off what´s inside the block (continue). Let´s have a look!

Today you will need:

  1. 1 x ZumBloq LED
  2. 1 x ZumBloq push-button
  3. 1 x ZumBloq buzzer
  4. A ZUM BT 328 controller board or one compatible with Arduino UNO
  5. A USB cable

What will the program for breaking out of the loop look like? This program will stop the blinking:But how would a program that continues the blinking but stops the buzzer from going off look?

Have a go yourself and you´ll see how it works.