Hi.. Hopefully someone can answer this quickly...
I'm having difficulty being able to light up a row of leds - I'm using the arduino shift register examples, but still can't see how to properly shift from the 1st register to the nth register.
I want to light up a long bank of leds - being able to control then in a sequential fashion... e.g., be able to light up 1 at a time starting from 1 to 16 - also to be able to specify a particular one to be lit.
I'm including the code below... if possible could you indicate what is wrong with the code...
I appreciate it...
/*
chain 1 or more shift registers
hook up a row of leds - say 16
be able to light from the 1st to the 16th one at a time
*/
//Pin connected to ST_CP of 74HC595
int latchPin = 8;
//Pin connected to SH_CP of 74HC595
int clockPin = 12;
////Pin connected to DS of 74HC595
int dataPin = 11;
void setup() {
//set pins to output because they are addressed in the main loop
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
}
void loop() {
//for (int j = 0; j < 16; j++) {
writeout(12);
//}
}
void writeout(int j) {
//ground latchPin and hold low for as long as you are transmitting
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, j);
//return the latch pin high to signal chip that it
//no longer needs to listen for information
digitalWrite(latchPin, HIGH);
delay(1000);
}