
75Chapter 4: More Links, More Precision
Serial.println(count);
delay(100);
}
for (count = 90; count > 0; count--) {
Serial.print("Our for loop is counting down! ");
Serial.println(count);
delay(100);
}
}
Compile and upload the code above. Once the code uploads to your Arduino,
open the Serial Monitor and check the output. If all goes as planned, you
should see the for loop slowly counting up from 0 to 90, then counting back
down to 0, and looping over and over again (Figure
4-16
).
Let’s break down our code to get a better understanding of just how the for
loop code works. The first line of code is some simple code establishing a
variable. In this ...