O'Reilly logo

Mastering Arduino by Jon Hoffman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Looping

The Arduino programming language has three looping statements which are the for, while and do/while loops. We will start off by looking at the for loop.

The for loop is used to repeatedly execute a block of code. The for loop is usually used to execute a block of code a specific number of times or to access elements in an array. There are three parts to the for statement. These parts are the initialization, condition, and increment.

In the initialization portion of the for statement, we initialize any variables that need to be initialized. There can be multiple initializations separated by commas, but I would recommend avoiding any initialization here that is not directly related to the for loop.

The condition portion of the for

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required