/*
Scrolling text in four 8x8 LED Dot Matrix displays
using MaxMatrix library
*/
#include "MaxMatrix.h"
//#include "character_map.h"
#include "dor_matrix_font.h"
MaxMatrix My_LED_Dot_Matrix(DATA_IN, LOAD_IN, CLOCK_IN, MAX7219_IN_USE);
byte buffer[MAX_BUFFER];
char msg_text1[]= " Microprocessor and Microcontroller Systems "; //string text 1
char msg_text2[]= " Scrolling text demo in LED Dot Matrix Displays "; //string text 2
char msg_text3[]= " using MaxMatrix Library in Arduino UNO "; //string text 3
void setup()
{
My_LED_Dot_Matrix.init(); //module initialize
My_LED_Dot_Matrix.setIntensity(LED_INTENSITY); //dot matix intensity 0-15
}
void loop()
{
printStringWithShift(msg_text1, SCROLL_SPEED); //scroll and display msg_text1
printStringWithShift(msg_text2, SCROLL_SPEED); //scroll and display msg_text2
printStringWithShift(msg_text3, SCROLL_SPEED); //scroll and display msg_text3
}
//Display the extracted characters with scrolling
void printCharWithShift(char char_display, int shift_speed)
{
if (char_display < MAX_COL)
return;
char_display -= MAX_COL;
memcpy_P(buffer, char_map + MAX_INDEX*char_display, MAX_INDEX);
My_LED_Dot_Matrix.writeSprite(MAX_COL, MIN_COL, buffer);
My_LED_Dot_Matrix.setColumn(MAX_COL + buffer[MIN_BUF_INDEX], MIN_INDEX);
for (int buff_index = MIN_BUF_INDEX; buff_index < buffer[MIN_BUF_INDEX] + 1; buff_index++)
{
delay(shift_speed);
My_LED_Dot_Matrix.shiftLeft(false, false);
}
}
// Extract the characters from the text string
void printStringWithShift(char* ptr_char, int shift_speed)
{
while (*ptr_char != NOT_EMPTY)
{
printCharWithShift(*ptr_char, shift_speed);
ptr_char++;
}
}