Problem with 595 tutorial: works every other time

I’ve attempted to replicate the setup of the 595 tutorial with LEDs, and I’m having a problem. It was going through the count-up, but flashing in between each LED display. I tried to figure out why it was doing it, and I realized that what’s happening is that only every other byte shifted out is being displayed, and all the LEDs are off for the byte in between. So, for example, when it’s counting up from 0 to 255, only the odd numbers are displayed. The LEDs are all connected, though, because if I set up the for loop to only show even numbers then they get shown, but only every second even number. Similarly, flashing all the LEDs works.

I don’t think it’s a software problem, because I’ve both written my own routines, and cut and paste the demo code from the tutorial page. Anybody have any idea what could be causing this?

If the demo program works with your hardware then the problem is probably in your software, posting it would help to see what’s going on.

If the demo program has the same problem then double check that your first led is connected to the shift registers Q0 pin.

All the demo programs have the same problem, and the Q0 pin is connected to my first LED.

I found the problem. The 5V on the breadboard was improperly connected to the 5V on the Arduino. ::)

Now I want to try to figure out why that caused this behaviour. Any ideas?

Edit: fixed typo

Properly or improperly? How was it connected?

I found the problem. The 5V on the breadboard was properly connected to the 5V on the Arduino. ::)

Now I want to try to figure out why that caused this behaviour. Any ideas?

Oops! I meant *im*properly (which, in this case, was a euphemism for "not connected at all").

Now I'm confused: I went out and drank a lot of wine, came home and debugged a problem I couldn't fix before having the wine, and then reported it incorrectly afterwards. Is the moral of this story to not drink and work on electronics, or that drinking actually helps debugging? ;)

I'd like to know how it was connected or not. I assume you mean the vcc was disconnected. That would be odd. I would suspect it was getting power from the serial input somehow.

And I've done the tearing my hair out and then quitting only to come back....much later and fixing it. It convinced me to just leave something alone for a while. ;)

Take care.