Try again and your LED should blink away merrily once per second.
You may have noticed the comment at the top of the listing saying “sketch 3-01.” To
save you some typing, we have uploaded to the book’s website all the sketches with such a
comment at the top. You can download them from
http://www.arduinobook.com
.
Variables
In this Blink example, you use pin 13 and have to refer to it in three places. If you decided
to use a different pin, then you would have to change the code in three places. Similarly, if
you wanted to change the rate of blinking, controlled by the argument to delay, you would
have to change 500 to some other number in more than one place.
Variables can be thought of as giving a name to a number. Actually, they can be a lot
more powerful than this, but for now, you will use them for this purpose.
When
defining a variable in C, you have to specify the type of the variable. We want
our
variables to be whole numbers,
which in C are called
Dostları ilə paylaş: