Datasheet
Not Quite Working
Sorry to sound like a broken
record but it is probably
something as simple as a
crossed wire.
17
CIRC-05
More details, where to buy more parts, where to ask more questions:
http://ardx.org/CIRC05
The Arduino’s power
LED goes out
This happened to us a couple
of times, it happens when the
chip is inserted backwards. If
you fix it quickly nothing will
break.
//between LED updates
Doing it the hard way:
for(int i = 0; i < 8; i++){
An Arduino makes rather complex actions very easy, shifting out data is
changeLED(i,ON);
one of these cases. However one of the nice features of an Arduino is
delay(delayTime);
}
you can make things as easy or difficult as you like. Let's try an
for(int i = 0; i < 8; i++){
example of this. In your loop switch the line:
changeLED(i,OFF);
delay(delayTime);
updateLEDs(i) -> updateLEDsLong(i);
}
Upload the program and notice nothing has changed. If you look at the
Uploading this will cause the lights to light up one after another and then off
code you can see how we are communicating with the chip one bit at a
in a similar manner. Check the code and wikipedia to see how it works, or
time. (for more details http://ardx.org/SPI ).
shoot us an e-mail if you have questions.
Controlling individual LEDs:
More animations:
Time to start controlling the LEDs in a similar method as we did in
Now things get more interesting. If you look back to the code from CIRC02 (8
CIRC02. As the eight LED states are stored in one byte (an 8 bit value)
LED Fun) you see we change the LEDs using digitalWrite(led, state), this is
for details on how this works try http://ardx.org/BINA. An Arduino is
the same format as the routine we wrote changeLED(led, state). You can use
very good at manipulating bits and there are an entire set of operators
the animations you wrote for CIRC02 by copying the code into this sketch and
that help us out. Details on bitwise maths ( http://ardx.org/BITW ).
changing all the digitalWrite()'s to changeLED()'s. Powerful? Very. (you'll also
need to change a few other things but follow the compile errors and it works
Our implementation.
Replace the loop() code with
itself out).
int delayTime = 100; //the number of milliseconds
//to delay
Frustration?
Shoot us an e-mail, this circuit
is both simple and complex at
the same time. We want to
hear about problems you have
so we can address them in
future editions.
help@oomlout.com
Download the Code from ( http://ardx.org/CODE05 )
(copy the text and paste it into an empty Arduino Sketch)
//Pin Definitions
//The 74HC595 uses a serial communication
//link which has three pins
digitalWrite(latch, LOW);
int data = 2;
int clock = 3;
//Pulls the chips latch low
int latch = 4;
shiftOut(data, clock, MSBFIRST, value);
//Shifts out 8 bits to the shift register
void setup() //runs once
{
pinMode(data, OUTPUT);
digitalWrite(latch, HIGH);
pinMode(clock, OUTPUT);
//Pulls the latch high displaying the data
pinMode(latch, OUTPUT); }
}
void loop() // run over and over again
---------- More Code Online ----------
{
int delayTime = 100;
//delay between LED updates
for(int i = 0; i < 256; i++){
updateLEDs(i);
delay(delayTime); }
}
/*
* updateLEDs() - sends the LED states set
* in value to the 74HC595 sequence
*/
void updateLEDs(int value){
NOT WORKING? (3 things to try)
MAKING IT BETTER
CODE (no need to type everything in just click)
MORE, MORE, MORE: