Pages: 1 [2]   Go Down
Author Topic: how to drive 25 led with 5 pcs of 595 shift register?  (Read 1290 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You can either slow it down or you can use buffers.

Both are very simple.

can you direct me how? with some link maybe?

Offline Offline
Edison Member
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you are using hardware spi, you can change the clock rate.

If you are using software spi, you can insert delays, like this:

#define spi_delay()  {NOP(); NOP(); NOP(); NOP(); NOP();} //insert your delay here. example uses 5 nop instructions

void myshiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val)
uint8_t i;

for (i = 0; i < 8; i++)  {
digitalWrite(clockPin, LOW);
                spi_delay(); //insert delay
if (bitOrder == LSBFIRST)
digitalWrite(dataPin, !!(val & (1 << i)));
digitalWrite(dataPin, !!(val & (1 << (7 - i))));

                spi_delay(); //insert delay
digitalWrite(clockPin, HIGH);
                spi_delay(); //insert delay

By changing the delay you use, you can slow down myshiftOut() as much as you want.

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
Karma: 545
Posts: 27357
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You guys are getting carried away on th clock rates.
You've got 25 LEDs a meter apart going down the length of a swimming pool, they pace a swimmer and don't get updated all that quick.

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at
Arduino for Teens available at

Pages: 1 [2]   Go Up
Jump to: