Go Down

Topic: Controlling multiple LEDs using shift register (Read 2224 times) previous topic - next topic


I am using Arduino in a school project this semester and i'd like to hock Arduino Uno up with 50-60 LEDs using 74HC595 Shift registers and i can't find out how to induvidially control the LEDs. If anyone knows this stuff better than me and would like to help with some code-strips it would be much appriciated.



i can't find out how to induvidially control the LEDs.

You have a byte array, one entry for each shift register.
When you want to turn an LED on or off you do a bit set or bit clear on the bit that corresponds to the LED you want to change and then write the whole array out to the shift registers.
Most of the LEDs are getting the same controlling bit as last time and so will not change, only the LED that you did the bit set or clear on will change.


Do you have pins to spare?  Consider this approach:
Wire the serial data out & shift clock lines together (pins 11 & 14), and use seperate load_clock lines (pin 12) so you can load each shift register independently for faster writes (do 1 shiftout command when there's a change in a byte, vs 7 or 8).  Each register will have its input register loaded, but only 1 will have the data transferred to its output register.

If you have the shiftouts as part of your overall loop, you can check if the data changed for any particular byte & shift out only the ones that changed.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Go Up