Using 5 LEDs on one Arduino

I am trying to make a light show using the Arduino RedBoard (equivalent to the Arduino Uno) made by Sparkfun. All the LEDs come out dim when I turn on the patterns, however when only one is turned on it works fine. My code is below, and uses the TimedAction library so that I can bypass the delay() function. Any help will be greatly appreciated to make these LEDs brighter, thanks!

#include <TimedAction.h>

TimedAction sequence2 = TimedAction(500, seq2);
TimedAction sequence3 = TimedAction(500, seq3);

int index = 0;
int index1 = 0;
int index2 = 0;
int leds = { 9, 10, 11, 12, 13 };

int states[5];

int buttonPin = 3;
int buttonState = 1;

long previousMillis = 0;
long interval = 500;

void setup() {
Serial.begin(9600);
sequence2.disable();
sequence3.disable();
}

// The loop function is called in an endless loop
void loop() {
switch (index) {
case 0:
for (int i = 0; i < 5; i++) {
states = random(2);
_ if (states == 0) {_
_ states = LOW;
* }
else if (states == 1) {
states = HIGH;
}
}
for (int i = 0; i < 5; i++) {
digitalWrite(leds, states);
}
delay(100);
if (digitalRead(buttonPin) != buttonState && digitalRead(buttonPin) == 1) {
lowAll();
index++;
buttonState = digitalRead(buttonPin);
sequence2.enable();
index1 = 0;
} else {
buttonState = digitalRead(buttonPin);
}
break;
case 1:
sequence2.check();
if (digitalRead(buttonPin) != buttonState && digitalRead(buttonPin) == 1) {
lowAll();
index++;
buttonState = digitalRead(buttonPin);
sequence2.disable();
sequence3.enable();
index1 = 0;
} else {
buttonState = digitalRead(buttonPin);
}
break;
case 2:
sequence3.check();
if (digitalRead(buttonPin) != buttonState && digitalRead(buttonPin) == 1) {
lowAll();
index = 0;
buttonState = digitalRead(buttonPin);
sequence3.disable();
index1 = 0;
} else {
buttonState = digitalRead(buttonPin);
}
break;
}
}
void lowAll() {
for (int i = 0; i < 5; i++) {
states = 0;
digitalWrite(leds, states);
}
}
void seq2() {
if (index1 == 0) {
lowAll();
digitalWrite(leds[0], HIGH);
digitalWrite(leds[4], HIGH);
index1++;
}
else if (index1 == 1) {
lowAll();
digitalWrite(leds[1], HIGH);
digitalWrite(leds[3], HIGH);
index1++;
}
else if (index1 == 2) {
lowAll();
digitalWrite(leds[2], HIGH);
index1++;
}
else if (index1 == 3) {
lowAll();
digitalWrite(leds[1], HIGH);
digitalWrite(leds[3], HIGH);
index1++;
}
else if (index1 == 4) {
lowAll();
digitalWrite(leds[0], HIGH);
digitalWrite(leds[4], HIGH);
index1 = 0;
sequence2.reset();
}
}
void seq3() {
if (index1 == 0) {
lowAll();
digitalWrite(leds[4], HIGH);
digitalWrite(leds[2], HIGH);
index1++;
}
else if (index1 == 1) {
lowAll();
digitalWrite(leds[3], HIGH);
digitalWrite(leds[1], HIGH);
index1++;
}
else if (index1 == 2) {
lowAll();
digitalWrite(leds[2], HIGH);
digitalWrite(leds[0], HIGH);
index1++;
}
else if (index1 == 3) {
lowAll();
digitalWrite(leds[3], HIGH);
digitalWrite(leds[1], HIGH);
index1++;
}
else if (index1 == 4) {
lowAll();
digitalWrite(leds[4], HIGH);
digitalWrite(leds[2], HIGH);
index1 = 0;
}
}*_

justein:
I am trying to make a light show using the Arduino RedBoard (equivalent to the Arduino Uno) made by Sparkfun. All the LEDs come out dim when I turn on the patterns, however when only one is turned on it works fine. My code is below, and uses the TimedAction library so that I can bypass the delay() function. Any help will be greatly appreciated to make these LEDs brighter, thanks!

Could you post the code please, and maybe a diagram of the circuit?

I just realized that I forgot to post the code... the code is posted. I'll take a diagram of the circuit and post it soon. In the meantime, I'll include an explanation:

Each LED is connected directly to a digital pin, then connected to a 330Ohm resistor and to a ground on the breadboard. The button is connected to a 10K resistor, a digital pin and a ground.

Each LED is connected directly to a digital pin, then connected to a 330Ohm resistor and to a ground on the breadboard. The button is connected to a 10K resistor, a digital pin and a ground.

Your kidding right ?
That will never work.

You mean you didn't research driving leds from an arduino ?
The correct resistor value is 220 ohms.
You will get the brightest illumination if you connect the led to +5V and turn it on by outputing a LOW to the digital pin to SINK the current instead of SOURCING it. If you are currently turning the led on with a HIGH , then after re-wiring all the leds to +5V you would turn them on with a LOW. The digital outputs can SINK more current than they can SOURCE. This is generally true of all digital outputs.

First thing, and this is your only real problem - you are missing
pinMode(pinX, OUTPUT);
for each pin in setup.

Second thing - 330 ohm is fine.
Atmega328P can source and sink the SAME amount of current - up to 20mA, after that output voltage degrades as more current is drawn (lows start to rise up, highs start to sink down).
See 14.1:
"Each output buffer has symmetrical drive characteristics with both high sink and source capability."
and the notes in Table 29-1:
"3. Although each I/O port can source more than the test conditions (20mA at VCC = 5V, 10mA at VCC = 3V) under steady state conditions (non-transient), the following must be observed:
4. Although each I/O port can sink more than the test conditions (20mA at VCC = 5V, 10mA at VCC = 3V) under steady state conditions (non-transient), the following must be observed:
"

Assuming 2.2Vf for the LEDs, which is typical for Red, and a High out of 4.2V (minimum High out for 20mA and Vcc = 5V), then
(4.2V - 2.2V)/.02 = 100, so a 220 or 330 ohm resistor would just be less bright:
(4.2 - 2.2V)/330 = 6mA
(4.2-2.2)/220 = 9mA
Not as bright as 20mA, but still plenty viewable.

(4.2V - 2.2V)/.02 = 100, so a 220 or 330 ohm resistor would just be less bright:

(Vcc-Vf) / Iled= (5V-2.2V) / 0.020A = 140 ohms

So are you saying that if you are driving leds with TLC5940s that are SINKING the current the optimum current limiting resistor value is 140 ohms ?
Considering the TLC has a current limit resistor RIREF on pin 20 (default value = 1.8k - 2.0k ohm), how does the above calculation come into the discusstion ? Isn’t the current set by the IREF resistor on pin-20 , making it unnecessary to add series resistors on every led ?
I’m confused about that.

CrossRoads:
First thing, and this is your only real problem - you are missing
pinMode(pinX, OUTPUT);
for each pin in setup.

Second thing - 330 ohm is fine.
Atmega328P can source and sink the SAME amount of current - up to 20mA, after that output voltage degrades as more current is drawn (lows start to rise up, highs start to sink down).
See 14.1:
"Each output buffer has symmetrical drive characteristics with both high sink and source capability."
and the notes in Table 29-1:
"3. Although each I/O port can source more than the test conditions (20mA at VCC = 5V, 10mA at VCC = 3V) under steady state conditions (non-transient), the following must be observed:
4. Although each I/O port can sink more than the test conditions (20mA at VCC = 5V, 10mA at VCC = 3V) under steady state conditions (non-transient), the following must be observed:
"

Assuming 2.2Vf for the LEDs, which is typical for Red, and a High out of 4.2V (minimum High out for 20mA and Vcc = 5V), then
(4.2V - 2.2V)/.02 = 100, so a 220 or 330 ohm resistor would just be less bright:
(4.2 - 2.2V)/330 = 6mA
(4.2-2.2)/220 = 9mA
Not as bright as 20mA, but still plenty viewable.

Thank you, that fixed it! I feel so stupid that I forgot something so simple.

It happens.
I was writing come code yesterday to move thru rows of 2 arrays, one had rows of 9 bytes, the other had rows of 12 bytes.
I was going thru both in chunks of 9 bytes at a time and getting weird results - my college age son spotted that error for me. Just need another pair of eyes sometimes.

TLC5940 - the Ohms Law equation is not applicable - current is controlled internally. That has nothing to do with this topic.