#include <MD_MAX72XX.h>
#include <SPI.h>
// Define the number of devices we have in the chain
#define MAX_DEVICES 4
// SPI connections to the MAX7219 module
#define CLK_PIN 18 // SCK
#define DATA_PIN 19 // MOSI
#define CS_PIN 17 // can be any GPIO pin
// Create a new instance of the library
MD_MAX72XX mx = MD_MAX72XX(CS_PIN, MAX_DEVICES);
void setup() {
mx.begin();
mx.control(MD_MAX72XX::INTENSITY, 8); // Set the brightness (0-15)
mx.clear();
displayText("hello");
}
void loop() {
// Nothing needed in the loop for static text
}
void displayText(const char* text) {
uint8_t charWidth;
uint8_t cBuf[8]; // character buffer
mx.clear();
while (*text != '\0') {
charWidth = mx.getChar(*text++, sizeof(cBuf)/sizeof(cBuf[0]), cBuf);
for (uint8_t i=0; i<charWidth; i++) {
mx.setColumn(i, cBuf[i]);
}
delay(1000); // Display each character for 1 second
}
}