Screwed up, hoping for help on setting a pin as ground...

So, I screwed up. I'm making a really neat infinity mirror (two way mirror facing a normal mirror with LED's in between), however, I just finished soldering the whole project together and tested it out... I soldered every single stinking LED in backwards. All the positive leads go to a common ground, and all the ground wires are separated in painstakingly detailed, numbered, wires. woops.

I could take the entire project apart and try again (sigh), but I was hoping there was a trick with the arduino sketch to set the pins as ground instead of changing the wiring of my project? Then all I have to do is swap the common ground to common power and have each one ground out in the series that I'm shooting for.

I didn't have any luck googling or searching the forums. Any advice (other than re-doing all those little tiny solder points)?

much appreciated, yes I'm a total noob and this is my first arduino/electronics project :slight_smile:

Connect the common anode to +5v and then simply change any calls of:
digitalWrite(pin, HIGH);
digitalWrite(pin, LOW);
And vice versa.
That assumes you are not using transistors.

There is probably a better way to do it and that is to use some N MOSFETs (or NPN transistors). Connect the gate of the fet to the arduino pin, the source to GND and the drain to the LED. That circuit will act as an inverter which will do what you need whilst also protecting the arduino pins from having to sink as much current.

Thank you so much for the advice! I'm not sure about how to do transistors, but I'm going to read about them and see if it's worth giving them a shot for this project. Definitely not making that mistake again!

I have to know how many leds it was.
Trust me I'm laughing with you not at you.

thirty six. all nicely hot-glued into place, soldered to a common strand, evenly spaced and absolutely put in backwards grin

ouch. good luck man.

How are those LEDs connected to the Arduino? How much current do they take in total? While you can drive one LED directly fairly safely, it’s very easy to overload the Arduino output by trying to drive too many - the maximum safe current is only 20mA per pin.