// Source: https://lastminuteengineers.com/max7219-dot-matrix-arduino-tutorial/
// Including the required Arduino libraries
#include <MD_Parola.h>
#include <MD_MAX72xx.h> // will be installed with MD_Parola (dependency)
#include <SPI.h>
/* Important: Wokwi-Simulation needs "layout" : "fc16" to display as on my real Hardware...
{
"type": "wokwi-max7219-matrix",
"id": "matrix1",
"top": -450.6,
"left": -578.16,
"attrs": { "chain": "4" , "layout" : "fc16"}
}
*/
// Uncomment according to your hardware type
#define HARDWARE_TYPE MD_MAX72XX::FC16_HW // "blue" PCB - my real module
//#define HARDWARE_TYPE MD_MAX72XX::GENERIC_HW //
// #define HARDWARE_TYPE MD_MAX72XX::PAROLA_HW
// Defining size, and output pins
#define MAX_DEVICES 4
#define CS_PIN 5
// Create a new instance of the MD_Parola class with hardware SPI connection
MD_Parola myDisplay = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
void setup() {
// Initialize the object
myDisplay.begin();
// Set the intensity (brightness) of the display (0-15)
myDisplay.setIntensity(0);
// Clear the display
myDisplay.displayClear();
}
void loop() {
myDisplay.setTextAlignment(PA_LEFT);
myDisplay.print("Left");
delay(2000);
myDisplay.setTextAlignment(PA_CENTER);
myDisplay.print("Center");
delay(2000);
myDisplay.setTextAlignment(PA_RIGHT);
myDisplay.print("Right");
delay(2000);
myDisplay.setTextAlignment(PA_CENTER);
myDisplay.setInvert(true);
myDisplay.print("Invert");
delay(2000);
myDisplay.setInvert(false);
myDisplay.print(1234);
delay(2000);
}Push during startup
for setup mode
(skipped in emulator)