Arduino IDE: for Loop
A loop statement allows us to execute a statement or group of statements multiple times.
Below is the general form of a loop statement in most programming languages :
The for loop
A for loop executes statements a predetermined number of times. The control expression for the loop is initialised, tested and manipulated within the for loop parentheses. It is easy to debug the looping behaviour of the structure because it is independent of the activity inside the loop.
Each for loop has up to three expressions, which determine its operation. The following example shows the general for loop syntax in Arduino IDE. Notice that the three expressions in the for loop argument parentheses are separated with semicolons.
Below is the flow chart showing how a for loop works:
Arduino IDE: while Loop
This tutorial discusses Arduino while loop, what is a while loop, its general syntax in Arduino IDE, how it differs from a for loop, and how it works. It also covers Arduino while loop example. While loop in Arduino helps in executing a statement, or a group of statements continuously, and infinitely.