Hello,
after around 4 months I have to ask around for a Little help.
I have build a LED Matrix with 8x39 LED`s. The Goal is to send a Scrolling text from the Serial Monitor to the Arduino. The Text should run on the Matrix until a new Text is typed in the Serial Monitor.
#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_NeoPixel.h>
#ifndef PSTR
#define PSTR
#endif
#define PIN 6 // Ausgangspin
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(39, 8, PIN,
NEO_MATRIX_TOP + NEO_MATRIX_LEFT +
NEO_MATRIX_ROWS + NEO_MATRIX_ZIGZAG,
NEO_GRB + NEO_KHZ800);
const uint16_t colors[] = {
matrix.Color(100, 100, 100), matrix.Color(0, 100, 0), matrix.Color(0, 0, 100) }; //Farbkombinationsdurchläufe
void setup() {
matrix.begin();
matrix.setTextWrap(false); //buchstaben laufen von hinten flüssig ins bild; bei true springt jeder Buchstabe einzeln rein
matrix.setBrightness(40); // Gesamthelligkeit
matrix.setTextColor(colors[0]);
Serial.begin(9600);
}
int x = matrix.width();
int pass = 0;
void loop() {
matrix.fillScreen(0);
matrix.setCursor(x, 0);
{
if (Serial.available()) { // charakter erreichen serial port
delay(100); // warten, bis text ankommt
while (Serial.available() > 0) { // lese vorhandene charakter
matrix.write(Serial.read()); // charakter auf display
if(--x < -30) { //Gesamtweite des möglichen Textes
x = matrix.width();
if(++pass >= 3) pass = 0; //Anzahl der Farbdurchläufe
matrix.setTextColor(colors[pass]);
}
}
matrix.show();
delay(100); //Geschwindigkeit des Text-Durchlaufes
}
}
}
So the Text jumps with every send Message one Bit to the left on my Matrix.
Example I type an "A" send it and repeat this often the "A" slowly goes from right to left.
But it should be automatically Scrolling. I hope you guys can see my Problem?
Peace
