Two RGB Strips, one flashes on and off

Hi All,

I’m using an arduino mega to power two analog RGB strips. My circuit is set up correct, and the LED strips power on, but one of them will flash periodically when running this sample sketch:

#define REDPIN_L 7
#define GREENPIN_L 6
#define BLUEPIN_L 5

#define REDPIN_R 11
#define GREENPIN_R 10
#define BLUEPIN_R 8

#define FADESPEED 5     // make this higher to slow down

void setup() {
  pinMode(REDPIN_L, OUTPUT);
  pinMode(GREENPIN_L, OUTPUT);
  pinMode(BLUEPIN_L, OUTPUT);
  //
  pinMode(REDPIN_R, OUTPUT);
  pinMode(GREENPIN_R, OUTPUT);
  pinMode(BLUEPIN_R, OUTPUT);
}

void testAgain() {
 int r, g, b = random(255);
  
  analogWrite(REDPIN_L, r);
  analogWrite(REDPIN_R, r);

  analogWrite(BLUEPIN_L, b);
  analogWrite(BLUEPIN_R, b);

  analogWrite(GREENPIN_L, g);
  analogWrite(GREENPIN_R, g);

}

void loop() {

  int r, g, b;

  // fade from blue to violet
  for (r = 0; r < 256; r++) { 
    analogWrite(REDPIN_L, r);
    analogWrite(REDPIN_R, r);
    delay(FADESPEED);
  } 
  // fade from violet to red
  for (b = 255; b > 0; b--) { 
    analogWrite(BLUEPIN_L, b);
    analogWrite(BLUEPIN_R, b);
    delay(FADESPEED);
  } 
  // fade from red to yellow
  for (g = 0; g < 256; g++) { 
    analogWrite(GREENPIN_L, g);
    analogWrite(GREENPIN_R, g);
    delay(FADESPEED);
  } 
  // fade from yellow to green
  for (r = 255; r > 0; r--) { 
    analogWrite(REDPIN_L, r);
    analogWrite(REDPIN_R, r);
    delay(FADESPEED);
  } 
  // fade from green to teal
  for (b = 0; b < 256; b++) { 
    analogWrite(BLUEPIN_L, b);
    analogWrite(BLUEPIN_R, b);
    delay(FADESPEED);
  } 
  // fade from teal to blue
  for (g = 255; g > 0; g--) { 
    analogWrite(GREENPIN_L, g);
    analogWrite(GREENPIN_R, g);
    delay(FADESPEED);
  } 
}

is there something wrong with my code? they are both running off the same 12V, 3AMP power supply. I can’t get them to light up the same color…

these are the strips i’m using: http://learn.adafruit.com/rgb-led-strips/

thanks!

What do you have between the PWM pins and the LED strips? Arduino outputs can't handle 12V signals.

You never call void testAgain?