Datasheet

NOT WORKING? (3 things to try)
MAKING IT BETTER
CODE (no need to type everything in just click)
MORE, MORE, MORE:
Operating out of sequence
With eight wires it's easy to cross
a couple. Double check that the
first LED is plugged into pin 2 and
each pin there after.
11
CIRC-02
Download the Code from ( http://ardx.org/CODE02 )
(and then copy the text and paste it into an empty Arduino Sketch)
More details, where to buy more parts, where to ask more questions:
http://ardx.org/CIRC02
Some LEDs Fail to Light
It is easy to insert an LED
backwards. Check the LEDs
that aren't working and ensure
they the right way around.
Switching to loops: Extra animations:
Tired of this animation? Then try the other two
In the loop() function there are 4 lines. The last
sample animations. Uncomment their lines and upload
three all start with a '//'. This means the line is
the program to your board and enjoy the new light
treated as a comment (not run). To switch the
animations. (delete the slashes in front of row 3 and then 4)
program to use loops change the void loop()
code to:
Testing out your own animations:
//oneAfterAnotherNoLoop();
oneAfterAnotherLoop();
Jump into the included code and start changing
//oneOnAtATime();
things. The main point is to turn an LED on use
//inAndOut();
digitalWrite(pinNumber, HIGH); then to turn
Upload the program, and notice that nothing has
it off use digitalWrite(pinNumber, LOW); .
changed. You can take a look at the two
Type away, regardless of what you change you won't
functions, each does the same thing, but use
break anything.
different approaches (hint: the second one uses
a for loop).
Starting Afresh
Its easy to accidentally
misplace a wire without
noticing. Pulling everything out
and starting with a fresh slate
is often easier than trying to
track down the problem.
//LED Pin Variables * will then turn them off
int ledPins[] = {2,3,4,5,6,7,8,9};
//An array to hold the void oneAfterAnotherNoLoop(){
//pin each LED is connected to int delayTime = 100;
//i.e. LED #0 is connected to pin 2 / / t h e t i m e ( i n m i l l i s e c o n d s ) t o p a u s e
//between LEDs
void setup() digitalWrite(ledPins[0], HIGH); //Turns on LED #0
{ //(connected to pin 2)
for(int i = 0; i < 8; i++){ delay(delayTime); //waits delayTime milliseconds
//this is a loop and will repeat eight times ...
pinMode(ledPins[i],OUTPUT); ...
//we use this to set LED pins to output digitalWrite(ledPins[7], HIGH); //Turns on LED #7
} //(connected to pin 9)
} delay(delayTime); //waits delayTime milliseconds
//Turns Each LED Off
void loop() // run over and over again digitalWrite(ledPins[7], LOW); //Turns off LED #7
{ delay(delayTime); //waits delayTime milliseconds
oneAfterAnotherNoLoop(); ...
//this will turn on each LED one by
//one then turn each oneoff -----more code in the downloadable version------
//oneAfterAnotherLoop();
//this does the same as onAfterAnotherNoLoop
//but with much less typing
//oneOnAtATime();
//inAndOut();
}
/*
* oneAfterAnotherNoLoop() - Will light one then
* delay for delayTime then light the next LED it