56 March 2014
The message may be somewhat cryptic at this point in
your learning since we haven’t discussed what ‘declared’
This will open the page for digital Write where — as
you can see in Figure 3 — the values for the second
parameter are HIGH and LOW.
If we add back the H, then the program will compile.
While this example was simple, program debugging often
isn’t so easy since the error messages may be quite
cryptic. When it isn’t entirely clear what is going on, it’s
probably best to refer to code that you know works and
has a similar line in it so you can see what you might be
doing differently. If you still can’t figure it out, then it is
time to go on the Internet and ask the question on a
forum (more on that process later). We have been using
some terms that we haven’t yet defined (like function, int,
and void). We’ll do that a lot in our study of the Arduino
since there is just too much to introduce in a perfect order
all at once. We’ll get to those terms below.
Learning the Programming Language
Rules and Concepts
Arduino is — among other things — a programming
language. One of the first things to learn about the
Arduino language is that underlying it is the C and C++
programming styles. What Arduino does is provide a
novice-friendly buffer that hides some standard C and C++
requirements, and adds some pre-written functions that
help the novice use the Arduino board. [They also provide
many libraries of functions and many working projects to
use as examples.] You don’t need to know a thing about
C or C++ in order to use Arduino or follow this series.
Since the Arduino keeps it simple, you can often just
look at existing code to get an intuitive feel for what is
going on and pick up a lot of the rules by osmosis. Of
course, as you grow in this process and want to do more
complex things, you’ll also want to learn more about the
rules. Let’s first introduce some rules for a programming
concept called the variable.
What is a variable?
As we learned
earlier in this chapter,
elements that can take
different values. When
we define variables,
we must tell the
compiler what type of
a variable it is. To a
compiler, the variable
type indicates the
Post comments on this article and find any associated files and/or downloads at
■ FIGURE 1: Error.
■ FIGURE 2: Find in Reference.
■ FIGURE 3: Found in Reference.