/*
* Use of MAX72XX component to display a running text.
*
* for more examples:
* https://github.com/MajicDesigns/MD_Parola/tree/main/examples
* https://github.com/MajicDesigns/MD_MAX72XX/tree/main/examples
*/
// Header file includes
#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>
#include "Font7Seg.h"
// Define the number of devices we have in the chain and the hardware interface
// NOTE: These pin numbers will probably not work with your hardware and may
// need to be adapted
#define HARDWARE_TYPE MD_MAX72XX::PAROLA_HW
#define MAX_DEVICES 4 // Define the number of displays connected
#define CLK_PIN 13 // CLK or SCK
#define DATA_PIN 11 // DATA or MOSI
#define CS_PIN 10 // CS or SS
#define SPEED_TIME 75 // Speed of the transition
#define PAUSE_TIME 0
#define MAX_MESG 30
// Global variables
char szMesg[MAX_MESG + 1] = "Fadhil kamu ganteng banget ";
MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
void setup(void)
{
P.begin(2);
P.setInvert(false);
P.setZone(0, MAX_DEVICES - 4, MAX_DEVICES - 1);
P.setZone(1, MAX_DEVICES - 4, MAX_DEVICES - 1);
P.displayZoneText(1, szMesg, PA_CENTER, SPEED_TIME, PAUSE_TIME, PA_SCROLL_LEFT, PA_SCROLL_LEFT);
}
void loop(void)
{
// Run the display animation continuously
while (P.displayAnimate())
{
// Update the text if it reaches the end
if (P.getZoneStatus(0) == false)
{
P.displayReset(0); // Reset the zone to display text again
P.displayZoneText(1, szMesg, PA_CENTER, SPEED_TIME, PAUSE_TIME, PA_SCROLL_LEFT, PA_SCROLL_LEFT);
}
}
}