Qu-Bot, A Quickly Programmable Robot User’s Manual
Page
34
of
52
5. Programming in Qu-Bot Visual LAB (Loop Blocks)
We frequently need to perform an action over and over, often with variations in the
details each time. The mechanism, which meets this need, is the ‘loop’. In this section
we will learn how to use blocks listed under section 3.1.3.2.
5.1. WHILE(1) Infinite loop
5.1.1. Characteristics of WHILE(1) Block
This block generates an Infinite loop. Program will never reach beyond END WHILE
block of WHILE(1). Program sequence between WHILE(1) and END WHILE will be
repeated infinite times.
5.1.2. Blink LED1 forever
Above program will be executed as following.
First of all when code flow will encounter WHILE(1) block. The Qu-Bot will save the
position of the next block.
Then it will execute the program normally and LED1 will be on and off for 100mS.
When code flow encounters ENDWHILE block it will return to the position saved by
WHILE(1) block.
Hence the same sequence will be repeated endlessly.
5.2. WHILE(Condition) Conditional loop
This section is just to introduce this conditional looping block. Please check section
6.1.2 for more details on condition building.
5.2.1. Characteristics of WHILE(Condition) Block
This block generates a loop where condition is checked first. If the condition is true
the program sequence between WHILE(Condition) and END WHILE Blocks will be
executed and the condition will be checked again. Until the condition is true the
sequence between WHILE(Condition) and END WHILE Blocks will be repeated. If at