Hello, I've been working on a project which involves an arduino driving 4 12v led strips with PWM. each of the four strips is run through a TIP122 and can be turned on and off with a momentary switch and can be faded with a potentiometer. When I use the existing code (will post below) for one led strip, it works great. When I scale this up to all 4 strips, there is a flickering or twitching that occurs when I push the momentary switch in. I'm a bit stumped at this point as to how to eliminate this flickering and know that it probably has to do with my code. any suggestions/help would be greatly appreciated. code> #include const int buttonPin1 = 2; // the number of the button pin const int buttonPin2 = 3; const int buttonPin3 = 4; const int buttonPin4 = 7; const int buttonPin5 = 8; const int transistorPin1 = 5; // the number of digital transistor pin const int transistorPin2 = 6; const int transistorPin3 = 9; const int transistorPin4 = 10; const int transistorPin5 = 11; // variables will change: int buttonPushCounter = 0; int buttonState1 = 0; // variable for reading the pushbutton status int buttonState2 = 0; int buttonState3 = 0; int buttonState4 = 0; int buttonState5 = 0; int lastButtonState = 0; int potPin1 = A0; // select the input pin for the potentiometer int potPin2 = A1; int potPin3 = A2; int potPin4 = A3; int potPin5 = A4; int val = 0; // variable to store the value coming from the sensor Bounce bouncer1 = Bounce(buttonPin1, 20); Bounce bouncer2 = Bounce(buttonPin2, 20); // When bouncing another pin change initiator before = Bounce bouncer3 = Bounce(buttonPin3, 20); Bounce bouncer4 = Bounce(buttonPin4, 20); Bounce bouncer5 = Bounce(buttonPin5, 20); void setup() { pinMode(transistorPin1, OUTPUT); // declare the ledPin as an OUTPUT pinMode (potPin1, OUTPUT); pinMode (buttonPin1, INPUT); pinMode(transistorPin2, OUTPUT); // declare the ledPin as an OUTPUT pinMode (potPin2, OUTPUT); pinMode (buttonPin3, INPUT); pinMode(transistorPin3, OUTPUT); // declare the ledPin as an OUTPUT pinMode (potPin3, OUTPUT); pinMode (buttonPin3, INPUT); pinMode(transistorPin4, OUTPUT); // declare the ledPin as an OUTPUT pinMode (potPin4, OUTPUT); pinMode (buttonPin4, INPUT); pinMode(transistorPin5, OUTPUT); // declare the ledPin as an OUTPUT pinMode (potPin5, OUTPUT); pinMode (buttonPin5, INPUT); Serial.begin(9600); } void loop(){ bouncer1.update(); bouncer2.update(); bouncer3.update(); bouncer4.update(); bouncer5.update(); buttonState1 = bouncer1.read(); //read the bouncing momentary switches- each associated with the separate switch conditions below. buttonState2 = bouncer2.read(); buttonState3 = bouncer3.read(); buttonState4 = bouncer4.read(); buttonState5 = bouncer5.read(); if (buttonState1 != lastButtonState){ if (buttonState1 == HIGH){ buttonPushCounter++; Serial.println ("on"); Serial.println ("number of button pushes: "); Serial.println (buttonPushCounter); } else { Serial.println ("off"); } } lastButtonState = buttonState1; if (buttonPushCounter % 2 == 0) { digitalWrite(transistorPin1, HIGH); } else { // read the potentiometer: int sensorValue = analogRead(A0); // map the sensor value to a range from 0 - 255: int outputValue = map(sensorValue, 0, 1023, 0, 255); // use that to control the transistor: analogWrite(transistorPin1, outputValue); } if (buttonState2 != lastButtonState){ if (buttonState2 == HIGH){ buttonPushCounter++; Serial.println ("on"); Serial.println ("number of button pushes: "); Serial.println (buttonPushCounter); } else { Serial.println ("off"); } } lastButtonState = buttonState2; if (buttonPushCounter % 2 == 0) { digitalWrite(transistorPin2, HIGH); } else { // read the potentiometer: int sensorValue = analogRead(A1); // map the sensor value to a range from 0 - 255: int outputValue = map(sensorValue, 0, 1023, 0, 255); // use that to control the transistor: analogWrite(transistorPin2, outputValue); } if (buttonState3 != lastButtonState){ if (buttonState3 == HIGH){ buttonPushCounter++; Serial.println ("on"); Serial.println ("number of button pushes: "); Serial.println (buttonPushCounter); } else { Serial.println ("off"); } } lastButtonState = buttonState3; if (buttonPushCounter % 2 == 0) { digitalWrite(transistorPin3, HIGH); } else { // read the potentiometer: int sensorValue = analogRead(A2); // map the sensor value to a range from 0 - 255: int outputValue = map(sensorValue, 0, 1023, 0, 255); // use that to control the transistor: analogWrite(transistorPin3, outputValue); } if (buttonState4 != lastButtonState){ if (buttonState4 == HIGH){ buttonPushCounter++; Serial.println ("on"); Serial.println ("number of button pushes: "); Serial.println (buttonPushCounter); } else { Serial.println ("off"); } } lastButtonState = buttonState4; if (buttonPushCounter % 2 == 0) { digitalWrite(transistorPin4, HIGH); } else { // read the potentiometer: int sensorValue = analogRead(A3); // map the sensor value to a range from 0 - 255: int outputValue = map(sensorValue, 0, 1023, 0, 255); // use that to control the transistor: analogWrite(transistorPin4, outputValue); } } <code