Create button presets with RGB strips

Hi, thanks in advance for any responses to help me out.

I am working on a TV show in ATL and have been tasked with installing lights in an Elevator set. The elevator will have a panel with three level indicators that are a rectangular shape rather than a traditional circle. The director has specifically asked for all indicators to be Yellow and the floor selected to illuminate red.

My goal is to use three 4 inch RGBW strip lights with an Arduino Due (as I already have one) and three buttons. Each strip will be behind translucent white plexiglass. As each button (level) is pressed it turns Red and when another button (level) is pressed it returns back to yellow and the newest selection turns red.

Im completely green at Arduino but figured this would be the best way to achieve what I need with the most amount of flexibility in getting specific colors. I've researched a lot obviously but have seen most projects cycling through colors on a loop or chasing with a single LED strip. Any help is much appreciated.

Thank you!

Looking into “StateChangeDetection”. Am I looking in the right direction?

You're on the right track.

if a button becomes pressed
{
  make all leds yellow
  make the led that is associated with the button red
}

Ok this is my 1st attempt with my limited knowledge.

/* Goal is to create level indecator lights for an elevator. When truned on all levels are yellow. 
 *  When a level is selected the light turns red while others remain yellow. Using three seperate RGBW strips,
 *  three buttons and an Arduino Due. 
 */
 
// list of the three rgbw led srips and three buttons

// first strip (level 1)
const int ledPin_Red = 2;
const int ledPin_Green = 3;
const int ledPin_Blue = 4;
const int ledPin_White = 5;

// second strip (level 2)
const int ledPin_Red_2 = 6;
const int ledPin_Green_2 = 7;
const int ledPin_Blue_2 = 8;
const int ledPin_White_2 = 9;

// thrid strip (level 3)
const int ledPin_Red_3 = 10;
const int ledPin_Green_3 = 11;
const int ledPin_Blue_3 = 12;
const int ledPin_White_3 = 13;

// levels
const int buttonPin_1 = 22;
const int buttonPin_2 = 23;
const int buttonPin_3 = 24;



void setup() {
  // put your setup code here, to run once:

pinMode(ledPin_Red, OUTPUT);
pinMode(ledPin_Green, OUTPUT);
pinMode(ledPin_Blue, OUTPUT);
pinMode(ledPin_White, OUTPUT);

pinMode(ledPin_Red_2, OUTPUT);
pinMode(ledPin_Green_2, OUTPUT);
pinMode(ledPin_Blue_2, OUTPUT);
pinMode(ledPin_White_2, OUTPUT);

pinMode(ledPin_Red_3, OUTPUT);
pinMode(ledPin_Green_3, OUTPUT);
pinMode(ledPin_Blue_3, OUTPUT);
pinMode(ledPin_White_3, OUTPUT);

pinMode(buttonPin_1, INPUT_PULLUP);
pinMode(buttonPin_2, INPUT_PULLUP);
pinMode(buttonPin_3, INPUT_PULLUP);


}

void loop() {
  // each led strip will start as yellow at half brightness

  // level 1
  analogWrite (ledPin_Red, 128); 
  analogWrite (ledPin_Green, 128);
  analogWrite (ledPin_Blue, 0); 
  analogWrite (ledPin_White, 0);

  // level 2

  analogWrite (ledPin_Red_2, 128); 
  analogWrite (ledPin_Green_2, 128);
  analogWrite (ledPin_Blue_2, 0); 
  analogWrite (ledPin_White_2, 0);

  // level 3

  analogWrite (ledPin_Red_3, 128); 
  analogWrite (ledPin_Green_3, 128);
  analogWrite (ledPin_Blue_3, 0); 
  analogWrite (ledPin_White_3, 0);

  // when button representing a level is pressed it turns red 
  // all other levels go to yellow

  if (buttonPin_1 == LOW) {
    // input_pullup on 
    // level one turns red others turn yellow 

   // level 1
  analogWrite (ledPin_Red, 255); 
  analogWrite (ledPin_Green, 0);
  analogWrite (ledPin_Blue, 0); 
  analogWrite (ledPin_White, 0);

  // level 2

  analogWrite (ledPin_Red_2, 128); 
  analogWrite (ledPin_Green_2, 128);
  analogWrite (ledPin_Blue_2, 0); 
  analogWrite (ledPin_White_2, 0);

  // level 3

  analogWrite (ledPin_Red_3, 128); 
  analogWrite (ledPin_Green_3, 128);
  analogWrite (ledPin_Blue_3, 0); 
  analogWrite (ledPin_White_3, 0);

  }

  if (buttonPin_2 == LOW) {
    // input_pullup on  
    // level two turns red others turn yellow 

    // level 1
  analogWrite (ledPin_Red, 128); 
  analogWrite (ledPin_Green, 128);
  analogWrite (ledPin_Blue, 0); 
  analogWrite (ledPin_White, 0);

  // level 2

  analogWrite (ledPin_Red_2, 255); 
  analogWrite (ledPin_Green_2, 0);
  analogWrite (ledPin_Blue_2, 0); 
  analogWrite (ledPin_White_2, 0);

  // level 3

  analogWrite (ledPin_Red_3, 128); 
  analogWrite (ledPin_Green_3, 128);
  analogWrite (ledPin_Blue_3, 0); 
  analogWrite (ledPin_White_3, 0);

    
  }

  if (buttonPin_3 == LOW) {
    // input_pullup on 
    // level two turns red others turn yellow 

    // level 1
  analogWrite (ledPin_Red, 128); 
  analogWrite (ledPin_Green, 128);
  analogWrite (ledPin_Blue, 0); 
  analogWrite (ledPin_White, 0);

  // level 2

  analogWrite (ledPin_Red_2, 128); 
  analogWrite (ledPin_Green_2, 128);
  analogWrite (ledPin_Blue_2, 0); 
  analogWrite (ledPin_White_2, 0);

  // level 3

  analogWrite (ledPin_Red_3, 255); 
  analogWrite (ledPin_Green_3, 0);
  analogWrite (ledPin_Blue_3, 0); 
  analogWrite (ledPin_White_3, 0);

    
  }


  
  


  

}

Not sure if you know this but

On most Arduino boards (those with the ATmega168 or ATmega328P), this function works on pins 3, 5, 6, 9, 10, and 11. On the Arduino Mega, it works on pins 2 - 13 and 44 - 46. Older Arduino boards with an ATmega8 only support analogWrite() on pins 9, 10, and 11.

I assume you have a Mega.

So what you say when you post code is what it does and what you would like it to do.

I suspect you are not seeing the colours change because you are changing them too fast put a half second delay between changing the colours to see them.

First:

  1. If you want only red and yellow (like you asked) use only a red and a yellow strip.
  2. why are you using analogwrite()? Is it not better use digitalwrite()?
  3. this is a goob program to learn arrays and for statements. Do you know than? If not I suggest you to learn what they are and how to use they

Sorry for my bad English

Silente:
First:

  1. If you want only red and yellow (like you asked) use only a red and a yellow strip.

Does such a thing exist? Have you a link?

  1. why are you using analogwrite()? Is it not better use digitalwrite()?

AnalogWrite will allow the control of brightness, digtalWrite will not. Also it is better for blending colours.

I don't hnow if a strip like this exist, I don't know if a yellow strip exist too. I have benn only thinking about remove white one, and yust because I don't know how, on a Due board you can controll 3*4=12 analogic pins, or what is the hutility of white strip in this case.

Maybe you should consider using WS2812 LED strips or panels, which can do any desired colour and only need one control pin.

They can be controlled using dedicated libraries such as FastLED.

I second the addressable LEDs. These things are absolutely perfect for what you're describing. You can control each LED (pixel) independently and from a single pin as mentioned. Look up WS2812B strips.