Go Down

Topic: Screwed up, hoping for help on setting a pin as ground... (Read 734 times) previous topic - next topic

richardoson

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  :)

Tom Carpenter

#1
Aug 18, 2012, 12:45 am Last Edit: Aug 18, 2012, 12:48 am by Tom Carpenter Reason: 1
Connect the common anode to +5v and then simply change any calls of:
digitalWrite(pin, HIGH);
To:
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.
~Tom~

richardoson

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!

jointtech

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

richardoson

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


PeterH

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.
I only provide help via the forum - please do not contact me for private consultancy.

Go Up