I am a beginner at using an Arduino and coding in general.
I have a project to program a display that uses neopixels set up in 10 rows and 60 columns. To make the display show what I wanted I used the neomatrix library and it worked for what I need.
However, I noticed that for some reason I cannot actually send the data for all 10 rows. The maximum I can do is 4 rows with my current program. To tackle the issue right now what I do is initialize a neomatrix (named display in the code below) of 4 rows and 60 columns, and simply rotate between 3 different pins (4 rows, 4 rows, 2 rows) to send the data. The issue here is that I must show the pixels before moving on to the next pin, which means that the first 4 rows update, then the next 4 rows update and so on. This is VERY noticeable (also because my code is slow), but I simply don't understand why I can't send data to more rows at once when I see many people online sending data to way more neopixels than I am.
I am quite sure it's not a powering issue, because testing has shown me that there simply isn't a signal going through instead of the neopixels needing more power.
What I mean is: I show text on the display with 4 rows, then I changed the sketch to send different text for 10 rows. The 4 rows are still on in the same fashion due to no new signal being sent through indicating they were not updated.
I tested further a 10-row declaration on only 2 physically connected rows, and the signal didn't send through. This has confused me very much.
I also noticed that the less memory I use, the more rows I can send data to. Smaller sketches have allowed me to send data for 6 rows.
Is there a way to solve this issue? I would greatly appreciate any guidance.
#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_NeoPixel.h>
#include <FiveByThreePixelFont.h>
//#include <Fonts/Picopixel.h>
#define DISPLAY_TOP_PIN 8
#define DISPLAY_MID_PIN 7
#define DISPLAY_BOT_PIN 6
#define STRIP_PIN 8
#define SMALL_ROWS 2
#define ROWS 4
#define COLS 60
#define STRIP_LENGTH ROWS*COLS
#define BRIGHTNESS 50
#define CYBER_BLUE display.Color(0,184,255)
#define CYBER_PINK display.Color(214,0,255)
#define CYBER_YELLOW display.Color(253,255,110)
#define BLANK display.Color(0,0,0)
Adafruit_NeoMatrix display = Adafruit_NeoMatrix(
COLS, ROWS, DISPLAY_TOP_PIN,
NEO_MATRIX_TOP + NEO_MATRIX_LEFT +
NEO_MATRIX_ROWS + NEO_MATRIX_ZIGZAG,
NEO_GRB + NEO_KHZ800
);
Adafruit_NeoPixel strip(STRIP_LENGTH, STRIP_PIN, NEO_GRB + NEO_KHZ800);
int highlight;
int default_color;
int max_x;
int x_location;
int y_location;
int universal_current_line = 0;
int scroll_draw_x = 0;
int row_limit = ROWS;
int line_length = 0;
void setup() {
Serial.begin(9600);
strip.begin();
strip.show();
strip.fill(strip.Color(255, 255, 0), 0, STRIP_LENGTH);
strip.show();
default_color = CYBER_BLUE;
display.begin();
display.setTextWrap(false);
display.setBrightness(BRIGHTNESS);
display.setTextColor(default_color);
display.setFont(&FiveByThreePixelFont);
display.setPin(DISPLAY_TOP_PIN);
highlight = 0;
x_location = 0;
y_location = 5;
String raw_text = " HELLO WORLD? BYE WORLD!!!";
int width = 4; //when changing fonts this changes as well, make it a global variable later
max_x = -(raw_text.length() + 2) * width;
}
void InitialMatrixTest() {
ScrollText();
int x = display.getCursorX();
int y = display.getCursorY();
//Add a single space padding to all incoming text
display.setPin(DISPLAY_TOP_PIN);
display.fillScreen(display.Color(0,0,0));
display.print(" HELLO ");
Highlight("WORLD");
display.print("?");
display.show();
display.setPin(DISPLAY_MID_PIN);
display.setCursor(x, y);
display.fillScreen(display.Color(0,0,0));
display.print(" BYE ");
Highlight("WORLD");
display.print("!!!");
display.show();
delay(10);
}
void ScrollText() {
x_location--;
if (x_location == max_x){
x_location = COLS;
}
display.setCursor(x_location, y_location);
}
void Highlight(String text) {
if (highlight == 1) {
display.setTextColor(CYBER_YELLOW);
highlight = 0;
} else {
display.setTextColor(CYBER_PINK);
highlight = 1;
}
display.print(text);
display.setTextColor(default_color);
}
void LoopMatrix() {
//UniversalMatrixPrint();
InitialMatrixTest();
}
void loop() {
LoopMatrix();
}