Code for reversed LEDs

5 views
Skip to first unread message

Ben Combee

unread,
Dec 15, 2009, 3:25:39 AM12/15/09
to makerb...@googlegroups.com
Here's my version of test sketch #2 for reversed red LEDs. I couldn't
quite figure out how to get the columns and rows to work right, so I
instead turn unused columns and rows to input mode which effectively
disconnects them.

void allOff()
{
for(int i=3; i<14; i++) {
pinMode(i, INPUT);
digitalWrite(i, LOW);
}
}

void lightLED(int row, int col)
{
allOff();
pinMode(row + 8, OUTPUT);
pinMode(col + 3, OUTPUT);
if (col == 2 || col == 3) {
digitalWrite(row + 8, LOW);
digitalWrite(col + 3, HIGH);
}
else {
digitalWrite(row + 8, HIGH);
digitalWrite(col + 3, LOW);
}
}

void setup() {
allOff();
}
// the loop() method runs over and over again,
// as long as the Arduino has power

void loop() {
for (int col = 0; col < 5; col++) {
for (int row = 0; row < 6; row++) {
lightLED(row, col);
delay(200);
}
}
}

Adam Mayer

unread,
Dec 15, 2009, 10:23:36 AM12/15/09
to makerb...@googlegroups.com
Yeah, you're really better off reversing the backwards LEDs. Having
the reds backwards will effectively give you "loops" in the grid, and
software can't really save you. It also gives you LED paths which
bypass the current limiting resistors, cutting your battery life down
significantly.

-a

Ben Combee

unread,
Dec 15, 2009, 11:00:08 AM12/15/09
to makerb...@googlegroups.com
On Tue, Dec 15, 2009 at 10:23 AM, Adam Mayer <pho...@gmail.com> wrote:
> Yeah, you're really better off reversing the backwards LEDs.  Having
> the reds backwards will effectively give you "loops" in the grid, and
> software can't really save you.  It also gives you LED paths which
> bypass the current limiting resistors, cutting your battery life down
> significantly.

Hmmm... I see how you can have a loop where current going out one
column pin would then return on a different column pin, but then it
would go through two resistors instead of none. To avoid any
resistors, you need current going out one row pin and back into
another which doesn't happen because all LEDs in any given row have
the same orientation.

I think as long as you can use the input pin mode to disconnect
columns from the circuit, you can manage this. Current won't flow
through a LEDs that's connected to an input, so as long as you just
connect one column at a time, your only issue is that the row pin
settings need to be reversed for the two columns that are reversed.

Anyway, my iron doesn't have a good tip for desoldering the wider LEDs
(I tried!), so I'm going to leave mine as-is for now.

bre pettis

unread,
Dec 15, 2009, 11:02:23 AM12/15/09
to makerb...@googlegroups.com
My experience with desoldering was to heat up one side till liquid,
then heat up the other side and then heat up the first side again
which won't have cooled much and then it will push off, Then I use the
surface tension to pull it back in to place and warmed everything up
again.

Bre

http://brepettis.com
http://makerbot.com

Matthew Wilson

unread,
Dec 15, 2009, 1:52:08 PM12/15/09
to makerb...@googlegroups.com
I've got a hot air rework station. If you mail me your board I'll
flip the LEDs around for you. Hit me off-list for an address.
Reply all
Reply to author
Forward
0 new messages