C H A P T E R  3

Working with Variables

In our last project, there is nothing in the sketch except for our comments that helps us to identify which color LED is connected to which pin on the Arduino board, or, for that matter, what color we are turning on or off at any given time in the code. We would just have to remember that the number 9 in the line digitalWrite(9, HIGH); refers to the Arduino pin 9 that the red LED is connected to. Rather than trying to remember these things, because honestly we will forget or the next person we share our code with will have no clue, there is a better way to write our code using something called variables.

In this chapter, we will revisit the last project, pulling from our magic hat to create seven colors ...

Get Beginning Arduino Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.