Please note: Friday June 18 is a holiday celebrating Juneteenth, please allow extra time for your order to arrive and plan accordingly.
0

Neopixel Panel
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Neopixel Panel

by pe_martin on Sat May 08, 2021 7:29 am

Hello! Tried to write or copy a sketch to write a different text on 2 panels (each 2x32).
The ideal would be the 1st line as ticker “LH A320-214 Simulator D-AIPB” and the 2nd line “In Operation” - flashing.
Many thanks for helping.
Best regards
peter

Code: Select all | TOGGLE FULL SIZE
#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_NeoPixel.h>

#define PIN1 5
#define PIN2 6

// MATRIX DECLARATION:
// Parameter 1 = width of NeoPixel matrix
// Parameter 2 = height of matrix
// Parameter 3 = pin number (most are valid)
// Parameter 4 = matrix layout flags, add together as needed:
//   NEO_MATRIX_TOP, NEO_MATRIX_BOTTOM, NEO_MATRIX_LEFT, NEO_MATRIX_RIGHT:
//     Position of the FIRST LED in the matrix; pick two, e.g.
//     NEO_MATRIX_TOP + NEO_MATRIX_LEFT for the top-left corner.
//   NEO_MATRIX_ROWS, NEO_MATRIX_COLUMNS: LEDs are arranged in horizontal
//     rows or in vertical columns, respectively; pick one or the other.
//   NEO_MATRIX_PROGRESSIVE, NEO_MATRIX_ZIGZAG: all rows/columns proceed
//     in the same order, or alternate lines reverse direction; pick one.
//   See example below for these values in action.
// Parameter 5 = pixel type flags, add together as needed:
//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)

Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(64, 8, PIN1,
  NEO_MATRIX_BOTTOM    + NEO_MATRIX_RIGHT +
  NEO_MATRIX_COLUMNS + NEO_MATRIX_ZIGZAG,  //NEO_MATRIX_COLUMNS + NEO_MATRIX_ZIGZAG, NEO_MATRIX_BOTTOM    + NEO_MATRIX_RIGHT
  NEO_GRB            + NEO_KHZ800);


const uint16_t colors[] = {
  matrix.Color(255, 0, 0), matrix.Color(0, 255, 0), matrix.Color(255, 255, 0),matrix.Color(0, 0, 255), matrix.Color(255, 0, 255), matrix.Color(0, 255, 255), matrix.Color(255, 255, 255)};

void setup() {
  matrix.begin();
  matrix.setTextWrap(false);
  matrix.setBrightness(5);
  matrix.setTextColor(colors[0]);
}

int x    = matrix.width();
int pass = 0;

void loop() {
  matrix.fillScreen(0);    //Turn off all the LEDs
  matrix.setCursor(x, 0);
  matrix.print(F("LH Simulator D-AIPB in Operation"));

  if( --x < -175 ) { //-175
    x = matrix.width();

    if(++pass >= 8) pass = 0;
    matrix.setTextColor(colors[pass]);
  }
  matrix.show();
  delay(50);
}

Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(64, 8, PIN2,
  NEO_MATRIX_BOTTOM    + NEO_MATRIX_RIGHT +
  NEO_MATRIX_COLUMNS + NEO_MATRIX_ZIGZAG,  //NEO_MATRIX_COLUMNS + NEO_MATRIX_ZIGZAG, NEO_MATRIX_BOTTOM    + NEO_MATRIX_RIGHT
  NEO_GRB            + NEO_KHZ800);

const uint16_t colors[] = {
  matrix.Color(255, 0, 0), matrix.Color(0, 255, 0), matrix.Color(255, 255, 0),matrix.Color(0, 0, 255), matrix.Color(255, 0, 255), matrix.Color(0, 255, 255), matrix.Color(255, 255, 255)};

void setup() {
  matrix.begin();
  matrix.setTextWrap(false);
  matrix.setBrightness(5);
  matrix.setTextColor(colors[0]);
}

int x    = matrix.width();
int pass = 0;

void loop() {
  matrix.fillScreen(0);    //Turn off all the LEDs
  matrix.setCursor(x, 0);
  matrix.print(F("In Operation"));

  if( --x < -175 ) { //-175
    x = matrix.width();

    if(++pass >= 8) pass = 0;
    matrix.setTextColor(colors[pass]);
  }
  matrix.show();
  delay(50);
}

pe_martin
 
Posts: 9
Joined: Thu Apr 29, 2021 4:48 am

Re: Neopixel Panel

by blnkjns on Sat May 08, 2021 8:30 am

I think for what you want it is better to treat it as 32x16 matrix, as the "zig-zag" is done on 32 pixels (I guess, not really sure, I only worked with 16x16 ones).
Another benefit from using it as 32 wide panel, is that scrolling moves "off screen" and not into the next half of the panel.
From the fact that you post the code, I assume you have a problem with it, but the post does not tell the problem!
The second line of text should be written from x,y=0,8 instead of x,y=32,0
Code: Select all | TOGGLE FULL SIZE
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(32, 16, PIN1,
  NEO_MATRIX_BOTTOM    + NEO_MATRIX_RIGHT +
  NEO_MATRIX_COLUMNS + NEO_MATRIX_ZIGZAG,  //NEO_MATRIX_COLUMNS + NEO_MATRIX_ZIGZAG, NEO_MATRIX_BOTTOM    + NEO_MATRIX_RIGHT
  NEO_GRB            + NEO_KHZ800);

blnkjns
 
Posts: 624
Joined: Fri Oct 02, 2020 3:33 am

Re: Neopixel Panel

by pe_martin on Sat May 08, 2021 8:48 am

Thats the panel!
So i want write something in the first line and something in the second.
Different color and different display like blinking or walking.
Best regards
peter
Attachments
20210508_143944832.jpg
20210508_143944832.jpg (323.01 KiB) Viewed 94 times

pe_martin
 
Posts: 9
Joined: Thu Apr 29, 2021 4:48 am

Re: Neopixel Panel

by blnkjns on Sat May 08, 2021 12:45 pm

So it is 64x16! That makes things indeed a little complicated. You can't just use the GFX method for zig-zag.
Lets assume you matrix-layout is
A C
B D
I would skip the GFX library in this situation, and start writing your own function like:
Code: Select all | TOGGLE FULL SIZE
void drawPixel(int x, int y, unsigned long color){
  x=constrain(x,0,WIDTH-1);
  y=constrain(y,0,HEIGHT=1);
  bool column=x/32;
  bool odd=y%2;
  int pixNumber=x%32*!odd+(31-x%32)*odd+column*512+y*32;
  matrix.drawPixel(pixNumber,color);
}
That takes care of the hard part: get a certain pixel lit. Now you can make a routine that reads the standard font files from GFX and writes the colour for each pixel to the correct position to the screen.

blnkjns
 
Posts: 624
Joined: Fri Oct 02, 2020 3:33 am

Re: Neopixel Panel

by pe_martin on Sat May 08, 2021 1:01 pm

Hallo!
Sorry again!
There are 2 rows with each 2x32*8.
I my original sketch the text is going from left to the right, then to the next row and again from left to the right.
Now i want different text. One text light drawn from left to the right (but only in the first row) and a 2. text writen in the 2. row perhapt blinking.
And i don´t know to realise this.
Sorry
peter

pe_martin
 
Posts: 9
Joined: Thu Apr 29, 2021 4:48 am

Re: Neopixel Panel

by blnkjns on Sun May 09, 2021 3:40 am

pe_martin wrote:There are 2 rows with each 2x32*8.

That is not in the photo, there I see at least 64x16.
What I'm trying to say, is that if you want 4 panels in that layout, connect them:
A C
B D
and NOT
A B
C D
And then write custom code starting with my function concept.
the GFX library will not help you with these layouts.

blnkjns
 
Posts: 624
Joined: Fri Oct 02, 2020 3:33 am

Re: Neopixel Panel

by pe_martin on Sun May 09, 2021 4:20 am

Hallo!
Many thanks! These are 4 Pixel Panels each 8 rows and 32 columuns, connected A-B-C-D.
So i will try your concept.
Thanks
peter

pe_martin
 
Posts: 9
Joined: Thu Apr 29, 2021 4:48 am

Re: Neopixel Panel

by pe_martin on Wed May 12, 2021 9:17 am

Hello!
I don´t find a solution.
I hope you can help me again.
Best regards
peter

pe_martin
 
Posts: 9
Joined: Thu Apr 29, 2021 4:48 am

Please be positive and constructive with your questions and comments.