@marco_c, I have been reading through your forum post, and reading through the examples.
Here is my desired project.
Arduino controlling 6 Max7219 8x8 Matrix LED. Setup in 2 zoned. Modules 0-3 = Z0 and modules 4-5 = Z1.
I am basing off the Parola_Zone_Sign Example.
So far, I have figured out how to create my zones (P.begin and P.setZone). I have also figured out what code makes the display (P.displayZoneText(0, pc[0], PA_CENTER, SPEED_TIME, SPLAT_PAUSE_TIME, PA_PRINT)
I figured out that the array *pc[] is where my messages are displayed. So far, I'm getting all the little nuances figured out.
But, here is my question. I would like to modify the message streams. Here is what I am "thinking", please let me know if I am on the right track. Here is the sketch I have pieced together. It won't compile (still working on aspects, so I have place holders).
//============ Includes / Defines ============
#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>
// Define the number of devices we have in the chain and the hardware interface
#define HARDWARE_TYPE MD_MAX72XX::PAROLA_HW
#define MAX_DEVICES 7
#define CLK_PIN 13
#define DATA_PIN 11
#define CS_PIN 10
#define SPEED_TIME 25
#define SPLAT_PAUSE_TIME 50
#define TEXT_PAUSE_TIME 1000
#define REAR_DATA_PORT 4
#define FRONT_DATA_PORT 2
// Hardware SPI connection
MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
//============ Constants ============
// --------- Constants ---------
uint8_t frameDelay = 25; // default frame delay value
// --------- Arrays ---------
char *pc[] = { "\x00f", "Evacuate" };
char *rdp[] = { [rand_data], "Stuff it Wolverine!", [rand_data], "Where's Francis?", [rand_data] };
char *fdp[] = { [rand_data] };
//============ VARIABLES (will change) ============
uint8_t curText;
uint8_t cycle_count = 0;
// [rand_data] = Random Data - Create random generator
//============ Setup function ============
void setup(void)
{
P.begin(2);
P.setZone(0, 0, REAR_DATA_PORT-1);
P.setZone(1, REAR_DATA_PORT, MAX_DEVICES-1);
// All zones
P.setInvert(false);
P.setIntensity(4);
// Specific zones
P.displayZoneText(0, rdp[cycle_count], PA_CENTER, SPEED_TIME, SPLAT_PAUSE_TIME, PA_PRINT);
P.displayZoneText(1, fdp[0], PA_CENTER, SPEED_TIME, TEXT_PAUSE_TIME, PA_PRINT);
}
//============ Loop Function ============
void loop(void)
{
static uint8_t inten = 0;
static int8_t offset = 1;
if (cycle_count < 5) {
cycle_count++;
} else if (cycle_count >= 5) {
cycle_count = 0;
}
if (P.displayAnimate()) // animates and returns true when an animation is completed
{
// Splats
if (P.getZoneStatus(0)) // in sync with zone 2, so do both
{
inten += offset;
if (inten == 15 || inten == 0)
offset = -offset;
P.setIntensity(0, inten);
P.displayReset(0);
}
// Message
if (P.getZoneStatus(1))
{
P.setInvert(1, !P.getInvert(1));
P.displayReset(1);
}
}
}
I am aware that in the zone_sign example, the loop function simply leaves the message alone and animates the message to either invert or flash on and off. I am looking to change the message.
-
Can I call the P.displayZoneText command in the loop function to change the message?
-
What is the base format being used for the Asterisk in Z0 and Z2 in the example? I am thinking I can use a random number generator to load the random patterns in that way. Am I correct?
Something else I noticed looking at the Zone_Sign example, the message does not scroll. My desired end result is to scroll the messages and just pop up the random data. However, if that is too much right now, I can work on the scrolling later. That is just a nice add on.
Thank you in advance for your help.