/*
SparkFun
Tinker
Kit
Example
sketch
04
MULTIPLE
LEDs
Make
six
LEDs
dance.
Dance
LEDs,
dance!
This
sketch
was
written
by
SparkFun
Electronics,
with
lots
of
help
from
the
Arduino
community.
This
code
is
completely
free
for
any
use.
Visit
http://learn.sparkfun.com/products/2
for
SIK
informatio
n.
Visit
http://www.arduino.cc
to
learn
more
about
Arduino.
*/
//
To
keep
track
of
all
the
LED
pins,
we'll
use
an
"array."
//
An
array
lets
you
store
a
group
of
variables,
and
refer
to
them
//
by
their
position,
or
"index."
Here
we're
creating
an
arra
y
of
//
six
integers,
and
initializing
them
to
a
set
of
values:
int ledPins[]
= {4,5,6,7,8,9};
void setup()
{
//create
a
local
variable
to
store
the
index
of
which
pin
w
e
want
to
control
int index;
//
For
the
for()
loop
below,
these
are
the
three
statements:
//
1.
index
=
0;
Before
starting,
make
index
=
0.
//
2.
index
<=
5;
If
index
is
less
or
equal
to
5,
run
th
e
following
code
//
3.
index++
Putting
"++"
after
a
variable
means
"add
o
ne
to
it".
//
When
the
test
in
statement
2
is
finally
false,
the
sketch
//
will
continue.
//
This
for()
loop
will
make
index
=
0,
then
run
the
pinMode
()
//
statement
within
the
brackets.
It
will
then
do
the
same
t
hing
//
for
index
=
2,
index
=
3,
etc.
all
the
way
to
index
=
5.
for(index
= 0;
index
<= 5;
index++)
{
pinMode(ledPins[index],OUTPUT);
}
}
void loop()
{
//
This
loop()
calls
functions
that
we've
written
further
be
low.
//
We've
disabled
some
of
these
by
commenting
them
out
(putt
ing
Page 23 of 63