[solved]_LED matrix with adafruit lib

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
wernsen
 
Posts: 4
Joined: Tue Mar 11, 2014 5:12 pm

[solved]_LED matrix with adafruit lib

Post by wernsen »

Hello Forom,

I am Martin. I have a question about driving a matrix out of 8 stripes each with 15 w2812 leds. right now I have a horizontal arrangement with the data beeing sourced individually at the right side. So every stripe (line) has its own data pin connected to a arduino. Now I wanted to create an array such like this:

Code: Select all

include <Adafruit_NeoPixel.h>

Adafruit_NeoPixel test[8] = {(15,0), (15,1), (15,2), (15,3), (15,4), (15,5), (15,6), (15,7)};

void setup() {
 
  int helligkeit = 50;
  
  for(int i = 0; i <= 7; i++)
  {
      test[i].begin();
      test[i].show();
      test[i].setBrightness(helligkeit);
  }
}

void loop() {
      test[0].setPixelColor(1,test[0].Color(255,0,0));
}
Unfortunately it is not working. There is no problem during the compilation. The stripes work with the strandtest individually.
Last edited by wernsen on Wed Mar 12, 2014 6:16 pm, edited 1 time in total.

wernsen
 
Posts: 4
Joined: Tue Mar 11, 2014 5:12 pm

Re: LED matrix with adafruit lib

Post by wernsen »

This works, but it is way to complex...

Code: Select all

#include <Adafruit_NeoPixel.h>

Adafruit_NeoPixel strip_0 = Adafruit_NeoPixel(15, 0);
Adafruit_NeoPixel strip_1 = Adafruit_NeoPixel(15, 1);
Adafruit_NeoPixel strip_2 = Adafruit_NeoPixel(15, 2);
Adafruit_NeoPixel strip_3 = Adafruit_NeoPixel(15, 3);
Adafruit_NeoPixel strip_4 = Adafruit_NeoPixel(15, 4);
Adafruit_NeoPixel strip_5 = Adafruit_NeoPixel(15, 5);
Adafruit_NeoPixel strip_6 = Adafruit_NeoPixel(15, 6);
Adafruit_NeoPixel strip_7 = Adafruit_NeoPixel(15, 7);


void setup() {
  
  int heligkeit = 30;
  
  strip_0.begin();
  strip_1.begin();
  strip_2.begin();
  strip_3.begin();
  strip_4.begin();
  strip_5.begin();
  strip_6.begin();
  strip_7.begin();
  
  strip_0.show();
  strip_1.show();
  strip_2.show();
  strip_3.show();
  strip_4.show();
  strip_5.show();
  strip_6.show();
  strip_7.show();
  
  strip_0.setBrightness(heligkeit);
  strip_1.setBrightness(heligkeit);
  strip_2.setBrightness(heligkeit);
  strip_3.setBrightness(heligkeit);
  strip_4.setBrightness(heligkeit);
  strip_5.setBrightness(heligkeit);
  strip_6.setBrightness(heligkeit);
  strip_7.setBrightness(heligkeit);
}

void loop() {
  // Some example procedures showing how to display to the pixels:
  
  for(int i = 0; i<=15; i++)
  {
    strip_0.setPixelColor(i,strip_1.Color(255,0,0));
  }
  strip_0.show();
  
    for(int i = 0; i<=15; i++)
  {
    strip_7.setPixelColor(i,strip_1.Color(255,0,0));
  }
  strip_7.show();
  
      for(int i = 0; i<=15; i++)
  {
    strip_5.setPixelColor(i,strip_1.Color(255,0,0));
  }
  strip_5.show();
}


User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: LED matrix with adafruit lib

Post by adafruit_support_mike »

Try an array of objects:

Code: Select all

#define STRIP_COUNT  8

Adafruit_NeoPixel  strip[ STRIP_COUNT ];

void setup() {
    for (int i=0 ; i < STRIP_COUNT ; i++) { 
        strip[ i ] = Adafruit_NeoPixel(15, i);
    }
}

User avatar
pburgess
 
Posts: 4161
Joined: Sun Oct 26, 2008 2:29 am

Re: LED matrix with adafruit lib

Post by pburgess »

You're missing a show() call in your loop(), that's all:

Code: Select all

void loop() {
      test[0].setPixelColor(1,test[0].Color(255,0,0));
      test[0].show();
}

wernsen
 
Posts: 4
Joined: Tue Mar 11, 2014 5:12 pm

Re: LED matrix with adafruit lib

Post by wernsen »

ok, thank you very much. I will try it.

ttyl

wernsen
 
Posts: 4
Joined: Tue Mar 11, 2014 5:12 pm

Re: LED matrix with adafruit lib

Post by wernsen »

ok this will work now...

Code: Select all

#include <Adafruit_NeoPixel.h>

#define STRIP_COUNT  2

Adafruit_NeoPixel strip[STRIP_COUNT] = {Adafruit_NeoPixel(15, 0), Adafruit_NeoPixel(15, 1)};

void setup() {
    strip[1].begin();
    strip[1].show();
    strip[1].setPixelColor(2,strip[0].Color(255,0,0));
    strip[1].show();
}

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”