From the course: Learning Arduino: Interfacing with Hardware

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Optional review: Understanding "for" loops

Optional review: Understanding "for" loops - Arduino Tutorial

From the course: Learning Arduino: Interfacing with Hardware

Start my 1-month free trial

Optional review: Understanding "for" loops

- [Instructor] In our LCD example we are going to use a for loop. So, in case it has been a while since you used a for loop, I'm going to go through that format in order to refresh your memory about it. So for loop starts with for and we have initialization. And the initialization is basically, where do we start the for loop and then, we have the condition, and in the condition we specify how many times we want the for loop to get executed. And then finally, the way we do the increments. And then we add whatever the code we want inside the two brackets. So lets take an example where we use a simple for loop, so initialization, I'm going to use integer value of counter, and remember in initialization I need to specify where I'm starting so in our example I'm going to start from zero. So the initial value is zero. So now according to how many times you want the loop to execute, you change the condition accordingly. So for example, if I want the counter to execute 10 times and in the…

Contents