Handling multiple strips of LEDs

Hello all,

I have a project where I am using 2 LED stripes and with those strips, I am dividing each strip into 3 channels where each channel gets 96 LEDs. Channel 2 has some overlap between 2 strips.

The colors are as follow:

Channel 1 - red
Channel 2 - green
Channel 3 - blue

I am able to initialize the channels without issue.

What happens after initializing is as follows:

When I change the color of channel 1, channel 2 becomes blue. When I change the color of channel 2, channel 3 becomes red.

I have been working to solve this issue for some time now.

My question here is this, is there any limitation to using multiple Neopixel strips? Also when I want to change a single LED (or in this case a 96 LEDs) do I need to output a color value for the rest of the strip?

Hello

I think it's a problem in your code

This doesn't look familiar, does it?
How to get the best out of this forum

Please read.

yes, of course

Ok, so what I am doing is that I am setting the specific LEDs for the channel (or in the code, the room) Here is code for my function that will set the LED color:

      void SetRoomColor(ColorObject RoomColor, bool saveRoomColor = true)
      {
        Serial.println("In the room Color object");
        LEDStrip *StripReference = m_StripArrayObjects[0];
        ColorObject modifiedColor;

        if(saveRoomColor)        
          m_RoomColor = RoomColor;
        
        modifiedColor.SetColor( (uint8_t)(((uint16_t)m_brightness * (uint16_t)RoomColor.GetRedValue()) / 255), 
                                (uint8_t)(((uint16_t)m_brightness * (uint16_t)RoomColor.GetGreenValue()) / 255), 
                                (uint8_t)(((uint16_t)m_brightness * (uint16_t)RoomColor.GetBlueValue()) / 255), 
                                RoomColor.GetWhiteValue());

        uint8_t positionCounter = 0;
        bool firstRunThroughComplete = false;

        if(GetStripReferenceSize() == 1)
        {
          for(int i = m_lowLEDIndex - 1; i < m_LEDCount + m_lowLEDIndex; i++)
          {
            StripReference->GetStripReference()->setPixelColor(i, modifiedColor.GetColorValue());
          }
            
          StripReference->GetStripReference()->show();
        }
        else
        {
          int firstStripLEDCount = StripReference->GetLEDCount() - (m_lowLEDIndex - 1);

          /*Serial.println("Printing Values");
          Serial.println(StripReference->GetLEDCount());
          Serial.println((m_lowLEDIndex - 1));
          Serial.println(firstStripLEDCount);
          Serial.println(m_lowLEDIndex - 1);
          Serial.println(firstStripLEDCount + (m_lowLEDIndex - 1));
          Serial.println(m_LEDCount - firstStripLEDCount);*/
          

          for(int i = m_lowLEDIndex - 1; i < firstStripLEDCount + (m_lowLEDIndex - 1); i++)
          {
            StripReference->GetStripReference()->setPixelColor(i, modifiedColor.GetColorValue());
          }
          StripReference->GetStripReference()->show();
          StripReference = m_StripArrayObjects[1];
          for(int i = 0; i < m_LEDCount - firstStripLEDCount; i++)
          {
            StripReference->GetStripReference()->setPixelColor(i, modifiedColor.GetColorValue());
          }
          StripReference->GetStripReference()->show();
        }
      }

and what is the problem with it?

The problem with the code is that when I change channel 2 color, channel 3 changes color to what channel 1's color is (which it is not suppose to)

Show full code, or better, a small example demonstrating the problem

Will do. I am working on a small demo of the issue and will be posting here later tonight

Memory usage if I understand your spec correctly
2 strips * 3 channels * 96 leds * 3 bytes = 1728 bytes

Which board do you use? It will need more than 2k RAM.

So much questioning, so much confusion.

Hello everyone, thank you for your patience! I was able to create a mininal example that shows the exact effect that is happening. At first, all of the LED lights initilize correctly. Then, as I start to turn the LEDs on/off they also change colors.

The initial colors are as follows:

Channel 1 - red
Channel 2 - green
Channel 3 - blue

For example, Channel 1 changes to a blue color when turning off. But back to red when turning on. Channel 2 remains the same color throughout the process. Channel 3 changes to a red color when turning off. But back to blue when turning on. I should also note that the last pixel in channel 1 remains blue. And the last pixel in Channel 3 remains green.

Lastly for those wondering, I am running an Arduino Mega

#include <Adafruit_NeoPixel.h>

//#include "MemoryFree.h"

Adafruit_NeoPixel m_StripReference_1;
Adafruit_NeoPixel m_StripReference_2;

void setup() {
  Serial.begin(9600);

  // put your setup code here, to run once:
  m_StripReference_1 = Adafruit_NeoPixel(144, 48, NEO_GRBW + NEO_KHZ800);
  m_StripReference_2 = Adafruit_NeoPixel(144, 49, NEO_GRBW + NEO_KHZ800);

  m_StripReference_1.begin();
  m_StripReference_2.begin();

  // Initial setup
  for(int i = 0; i < 142; i++)
  {
    m_StripReference_1.setPixelColor(i, m_StripReference_1.Color(10, 0, 0, 0));
  }

  m_StripReference_1.show();
  

  m_StripReference_1.setPixelColor(143, m_StripReference_1.Color(0, 10, 0, 0));
  m_StripReference_1.show();
  m_StripReference_2.setPixelColor(0, m_StripReference_2.Color(0, 10, 0, 0));
  m_StripReference_2.show();

  for(int i = 1; i < 143; i++)
  {
    m_StripReference_2.setPixelColor(i, m_StripReference_2.Color(0, 0, 10, 0));
  }  
  m_StripReference_2.show();
  delay(1000);
  
  // Turning Channel 1 off
  for(int i = 0; i < 142; i++)
  {
    m_StripReference_1.setPixelColor(i, m_StripReference_1.Color(0, 0, 0, 0));
    m_StripReference_1.show();
    delay(100);
  }

  // Turning Channel 1 on
  for(int i = 0; i < 142; i++)
  {
    m_StripReference_1.setPixelColor(i, m_StripReference_1.Color(10, 0, 0, 0));
    m_StripReference_1.show();
    delay(100);
  }

  // Turning Channel 2 off
  m_StripReference_1.setPixelColor(143, m_StripReference_1.Color(0, 0, 0, 0));
  m_StripReference_1.show();
  delay(250);
  m_StripReference_2.setPixelColor(0, m_StripReference_2.Color(0, 0, 0, 0));
  m_StripReference_2.show();
  delay(250);

  // Turning Channel 2 on
  m_StripReference_1.setPixelColor(143, m_StripReference_1.Color(0, 10, 0, 0));
  m_StripReference_1.show();
  delay(500);
  m_StripReference_2.setPixelColor(0, m_StripReference_2.Color(0, 10, 0, 0));
  m_StripReference_2.show();
  delay(500);

  // Turning Channel 3 off
  for(int i = 1; i < 143; i++)
  {
    m_StripReference_2.setPixelColor(i, m_StripReference_2.Color(0, 0, 0, 0));
    m_StripReference_2.show();
    delay(100);  
  }  

  // Turning Channel 3 on
  for(int i = 1; i < 143; i++)
  {
    m_StripReference_2.setPixelColor(i, m_StripReference_2.Color(0, 0, 10, 0));
    m_StripReference_2.show();
    delay(100);  
  }    
  Serial.println("Memory Free:");
  //Serial.println(freeMemory());
}

void loop() {
  // put your main code here, to run repeatedly:

}