Where is the extra current coming from? Arduino Uno - LED message display

Hello, All!

Problem: Why is one LED light dim when I only want the other bright? Where is this extra current coming from?

I have been working on an Arduino Uno project to create a LED message board made from individual LEDs. I am using a row and column system that will rapidly turn on and off (one light at a time) to spell out a scrolling message. This technique is used on Nerdkits.com (NerdKits - DIY Marquee LED Array Display). Since the Arduino Uno has a limited number of pins, I am going to double the amount by alternating the direction of the current (also shown on the nerdkits website). I have programmed it (with the code below) to flash one LED at a time in my 4x2 display of 8 LEDs. The problem is that when I turn on some LEDS, I get an extra LED lit dimly and I can’t figure out where the power could be coming from. It seems to be coming from one of the pins that I set to INPUT as to not give any power… Help would be much appreciated!

Code:

int r1 = 10;
int r2 = 12;
int c1 = 4;
int c2 = 2;
int T = 2000;
**void setup() { **

}
void loop() {
** pinMode(c2, INPUT);**
** pinMode(c1, OUTPUT);**
** pinMode(r1, OUTPUT);**
** pinMode(r2, INPUT);**
** digitalWrite(c1, LOW);**
** digitalWrite(r1, HIGH);**

** delay(T);**

** pinMode(c2, INPUT);**
** pinMode(c1, OUTPUT);**
** pinMode(r1, OUTPUT);**
** pinMode(r2, INPUT);**
** digitalWrite(r1, LOW);**
** digitalWrite(c1, HIGH);**

** delay(T);**

** pinMode(c2, OUTPUT);**
** pinMode(c1, INPUT);**
** pinMode(r1, OUTPUT);**
** pinMode(r2, INPUT);**
** digitalWrite(c2, LOW);**
** digitalWrite(r1, HIGH);**

** delay(T);**

** pinMode(c2, OUTPUT);**
** pinMode(c1, INPUT);**
** pinMode(r1, OUTPUT);**
** pinMode(r2, INPUT);**
** digitalWrite(r1, LOW);**
** digitalWrite(c2, HIGH);**

** delay(T);**

** pinMode(c2, INPUT);**
** pinMode(c1, OUTPUT);**
** pinMode(r1, INPUT);**
** pinMode(r2, OUTPUT);**
** digitalWrite(c1, LOW);**
** digitalWrite(r2, HIGH);**

** delay(T);**

** pinMode(c2, INPUT);**
** pinMode(c1, OUTPUT);**
** pinMode(r1, INPUT);**
** pinMode(r2, OUTPUT);**
** digitalWrite(r2, LOW);**
** digitalWrite(c1, HIGH);**

** delay(T);**

** pinMode(c2, OUTPUT);**
** pinMode(c1, INPUT);**
** pinMode(r1, INPUT);**
** pinMode(r2, OUTPUT);**
** digitalWrite(r2, HIGH);**
** digitalWrite(c2, LOW);**

** delay(T);**

** pinMode(c2, OUTPUT);**
** pinMode(c1, INPUT);**
** pinMode(r1, INPUT);**
** pinMode(r2, OUTPUT);**
** digitalWrite(r2, LOW);**
** digitalWrite(c2, HIGH);**

** delay(T);**

** pinMode(c2, OUTPUT);**
** pinMode(c1, INPUT);**
** pinMode(r1, INPUT);**
** pinMode(r2, OUTPUT);**
** digitalWrite(r2, HIGH);**
** digitalWrite(c2, LOW);**

** delay(T);**

** pinMode(c2, OUTPUT);**
** pinMode(c1, INPUT);**
** pinMode(r1, INPUT);**
** pinMode(r2, OUTPUT);**
** digitalWrite(r2, LOW);**
** digitalWrite(c2, HIGH);**

** delay(T);**

** pinMode(c2, OUTPUT);**
** pinMode(c1, INPUT);**
** pinMode(r1, OUTPUT);**
** pinMode(r2, INPUT);**
** digitalWrite(r1, LOW);**
** digitalWrite(c2, HIGH);**

** delay(T); **
}

An image is attached of my breadboard and LEDs and a second image is of one LED dimly lit when another LED is on HIGH

dimleds.tiff (870 KB)

Make sure you've turned off the internal pull-up resistor.

digitalWrite()...

...If the pin is configured as an INPUT, writing a HIGH value with digitalWrite() will enable an internal 20K pullup resistor (see the tutorial on digital pins). Writing LOW will disable the pullup. The pullup resistor is enough to light an LED dimly, so if LEDs appear to work, but very dimly, this is a likely cause. The remedy is to set the pin to an output with the pinMode() function.

If you want large numbers of LEDs without large numbers of IO pins, you should look into "Charlieplexing". This is how the LOL shield works.

You can get far more LEDs connected to fewer pins using this method, and the LOL library could probably be adapted to make your code simpler.