74hc595 - Connect leds with reversed polarity

Hi!

I'm new in arduino and electronics. I mastered the basics of 74hc595 shift registers. I can connect multiple leds, daisy chain multiple 74hc595 etc.

I have a little problem though. While trying to adapt a project I found on the web, I made a mistake and I soldered... 60 leds in the wrong polarity! :frowning:

Normally, according to all the examples related to 74hc595 I have seen so far, the led's positive leg (the longer one) goes to the outputs of the 74hc595 and its negative leg (the shorter one) goes to ground. Unfortunately, due to my mistake, this is not possible anymore, since all the anodes of the LEDs are soldered together. Their cathodes are free and their are the ones I have to connect to my shift register! Is there something I can change so that the connectors of my shift register have reverse polarity so that I can connect my LEDs as they are without resoldering all 60 of them! =(... please say yes! :slight_smile:

Connect the anodes to the positive supply. Connect the cathodes to the shift register outputs (through appropriate current-limiting resistors of course). Drive the shift register output LOW to illuminate the LED. This is inverted logic as compared to the other connection, i.e. anode to the shift register and cathode to ground. But the logic adjustment is easy to do in the code.

Hey, it works! This is great! Thanks so much!

I had to write my own shiftout function to do that. Correct? Not a big deal, but do you think I can achieve the same with the adruino's one?

do you think I can achieve the same with the adruino's one?

Why ever not?
It is only the data in you change. A zero means switch on and a one switch off.

If you can't get your head round that then invert the data in software by doing an exclusive OR with a mask of all ones, like this

invert = data ^ 0xFF;