Hi
i have the following code to write a message on the display and make it scroll. the only problem i have encountered is that that the message starts from the middle of the display and if the message is long, the second time it is shown, it will start from the middle of the previous message so a mixed character message is displayed:s
i have tried alter the program but with no success...does anyone know what i am doing wrong??
#include <SureLEDMatrix.h>
// ----- PIN Constants ----------------------------------
int PIN_CHIPSELECT_1 = 9; // CS for LED matrix 1
//int PIN_CHIPSELECT_2 = 7; // CS for LED matrix 2 //using one disp
int PIN_WRITE = 7;
int PIN_DATA = 8;
// Instance of LED matrices
SureLEDMatrix matrix1(PIN_CHIPSELECT_1, PIN_WRITE, PIN_DATA, kMatrixType_32x8);
//SureLEDMatrix matrix2(PIN_CHIPSELECT_2, PIN_WRITE, PIN_DATA, kMatrixType_32x8);
int scroll = 0;
int maxscroll = 200;
void setup()
{
// Initialize I/O pins
pinMode(PIN_CHIPSELECT_1, OUTPUT);
//pinMode(PIN_CHIPSELECT_2, OUTPUT);
pinMode(PIN_WRITE, OUTPUT);
pinMode(PIN_DATA, OUTPUT);
// Initialize the LED matrices
matrix1.Initialize();
matrix1.SetBrightness(7);
//matrix2.Initialize();
// matrix2.SetBrightness(5);
}
void loop()
{
// Draw the text on the right screen
matrix1.DrawText("Hello ", 5, scroll, true);
// Scroll 1 pixel to the left
scroll = scroll-24;
//delay(100);
if (scroll < -maxscroll)
{
scroll = 100;
}
}