I am now stuck. I would like to have "static" and "scrolling" text working throughout my code.
Have looked at many example code and docs online, but now just have brain fade
I cant see what I am not understanding, I know its user error but out out ideas and other ways how to test it.
The code cycles through and the static text shows ok but no scrolling text. Thought I was going to crack it today after a few days trying.
// using esp8266 D1 mini
#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>
#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
#define MAX_DEVICES 4
//#define CLK_PIN 14 // or SCK
//#define DATA_PIN 13 // or MOSI
#define CS_PIN 15 // or SS
// Create a new instance of the MD_Parola class with hardware SPI connection
MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
int onlyonce = 1;
// Messages in strings
uint8_t curString = 0;
const char *msg[] =
{
"First scrolling message",
"Second scrolling message",
"Third scrolling message"
};
// Pause time
const uint16_t PAUSE_TIME = 1000; // in milliseconds
void setup() {
Serial.begin(115200);
P.begin(); // Intialize the object
P.setIntensity(1); // Set the intensity (brightness) of the display (0-15)
//P.displayClear(); // Clear the display
P.displayScroll(msg[curString], PA_LEFT, PA_SCROLL_LEFT, 100); // Show scroll Text
}
void loop() {
Serial.println(onlyonce);
if (onlyonce == 1) {
P.setTextAlignment(PA_LEFT);
P.print("Start");
delay(1000);
}
onlyonce = 2;
Serial.println(onlyonce);
// just print some test
P.setTextAlignment(PA_LEFT);
P.print("Matrix");
delay(1000);
// put some other code here
// just STATIC print some text
P.setTextAlignment(PA_LEFT);
P.print("Working");
delay(1000);
// put some other code here
// // how do i put scrolling text here????????????????
if (P.displayAnimate()){
P.displayScroll(msg[1], PA_LEFT, PA_SCROLL_LEFT, 100);
P.displayReset();
}
// if (P.displayAnimate()) {
//
// //Serial.println(String(0));
// //Serial.println(msg[0]);
//
// switch (0) // just for testing force it to message zero
// {
// case 0:
// P.displayScroll(msg[0], PA_LEFT, PA_SCROLL_LEFT, 100);
// delay(2000);
// break;
//
// case 1:
// P.displayScroll(msg[1], PA_LEFT, PA_SCROLL_LEFT, 100);
// delay(2000);
// break;
//
// case 2:
// P.displayScroll(msg[2], PA_LEFT, PA_SCROLL_LEFT, 100);
// delay(2000);
// break;
//
// default:
// // if nothing else matches, do the default
// Serial.println("nothing");
// // default is optional
// break;
// P.displayReset();
// }
// PUT SOME OTHER CODE HERE
// JUST STATIC PRINT SOMETHING TO MATRIX - this does not work
P.setTextAlignment(PA_LEFT);
P.print("END");
delay(1000);
}