functions. As you know from the Blink example that you ran in
Chapter 2
, you have to
have some “boilerplate” code, as it is called, before you can add your own code into a
sketch. In Arduino programming the “boilerplate” code takes the form of the “setup” and
“loop” functions that must always be present in a sketch.
Figure 3-3
No
setup
or
loop
You will learn much more about functions later in the book, but for now, let’s accept
that you need this boilerplate code and just adapt your sketch so it will compile (see
Figure 3-4
).
The Arduino IDE has looked at your efforts at writing code and found them to be
acceptable. It tells you this by saying “Done Compiling” and reporting the size of the
sketch to you: 450 bytes. The IDE is also telling you that the maximum size is 32,256
bytes, so you still have lots of room to make your sketch bigger.
Let’s examine this boilerplate code that will form the starting point for every sketch that
you ever write. There are some new things here. For example, there is the word
Dostları ilə paylaş: