Scrolling_test+bluetooth

I am using MAX7219. I would like to make 16x64 LED matrix. my LED module is HS-1588BS. Anyone can help me? I am doing the display part now. Please teach me how to scroll the text. And, using android smart phone app to input a string and display it in the LED matrix via bluetooth. my bluetooth module is HC-06. Also, using arduino UNO for programming. pin 9 is connected to CS_2, pin 10 is connected to CS_1, pin 11 is connected to DATA_IN, pin 12 is connected to CLK. Each MAX7219 can control 8 LED matrix. So I am using 2 MAX7219 to control 16 LED matrix.

my program now is here:

unsigned char i;
unsigned char j;
unsigned char val;
int var;
/Port Definitions/
int Max7219_pinCLK = 12;
int Max7219_pinCS_1 = 10;
int Max7219_pinCS_2 = 9;
int Max7219_pinDIN = 11;

unsigned char disp1[38][8]={
{0x3C,0x42,0x42,0x42,0x42,0x42,0x42,0x3C},//0
{0x10,0x30,0x50,0x10,0x10,0x10,0x10,0x10},//1
{0x7E,0x2,0x2,0x7E,0x40,0x40,0x40,0x7E},//2
{0x3E,0x2,0x2,0x3E,0x2,0x2,0x3E,0x0},//3
{0x8,0x18,0x28,0x48,0xFE,0x8,0x8,0x8},//4
{0x3C,0x20,0x20,0x3C,0x4,0x4,0x3C,0x0},//5
{0x3C,0x20,0x20,0x3C,0x24,0x24,0x3C,0x0},//6
{0x3E,0x22,0x4,0x8,0x8,0x8,0x8,0x8},//7
{0x0,0x3E,0x22,0x22,0x3E,0x22,0x22,0x3E},//8
{0x3E,0x22,0x22,0x3E,0x2,0x2,0x2,0x3E},//9
{0x8,0x14,0x22,0x3E,0x22,0x22,0x22,0x22},//A
{0x3C,0x22,0x22,0x3E,0x22,0x22,0x3C,0x0},//B
{0x3C,0x40,0x40,0x40,0x40,0x40,0x3C,0x0},//C
{0x7C,0x42,0x42,0x42,0x42,0x42,0x7C,0x0},//D
{0x7C,0x40,0x40,0x7C,0x40,0x40,0x40,0x7C},//E
{0x7C,0x40,0x40,0x7C,0x40,0x40,0x40,0x40},//F
{0x3C,0x40,0x40,0x40,0x40,0x44,0x44,0x3C},//G
{0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44},//H
{0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x7C},//I
{0x3C,0x8,0x8,0x8,0x8,0x8,0x48,0x30},//J
{0x0,0x24,0x28,0x30,0x20,0x30,0x28,0x24},//K
{0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7C},//L
{0x81,0xC3,0xA5,0x99,0x81,0x81,0x81,0x81},//M
{0x0,0x42,0x62,0x52,0x4A,0x46,0x42,0x0},//N
{0x3C,0x42,0x42,0x42,0x42,0x42,0x42,0x3C},//O
{0x3C,0x22,0x22,0x22,0x3C,0x20,0x20,0x20},//P
{0x1C,0x22,0x22,0x22,0x22,0x26,0x22,0x1D},//Q
{0x3C,0x22,0x22,0x22,0x3C,0x24,0x22,0x21},//R
{0x0,0x1E,0x20,0x20,0x3E,0x2,0x2,0x3C},//S
{0x0,0x3E,0x8,0x8,0x8,0x8,0x8,0x8},//T
{0x42,0x42,0x42,0x42,0x42,0x42,0x22,0x1C},//U
{0x42,0x42,0x42,0x42,0x42,0x42,0x24,0x18},//V
{0x0,0x49,0x49,0x49,0x49,0x2A,0x1C,0x0},//W
{0x0,0x41,0x22,0x14,0x8,0x14,0x22,0x41},//X
{0x41,0x22,0x14,0x8,0x8,0x8,0x8,0x8},//Y
{0x0,0x7F,0x2,0x4,0x8,0x10,0x20,0x7F},//Z
};

void Write_Max7219_byte_address(unsigned char address)
{
unsigned char i;
for(i=8;i>=1;i–) //8 to 1 repeat 8 times
{
digitalWrite(Max7219_pinCLK,LOW);
digitalWrite(Max7219_pinDIN,address&0x80);// Extracting a bit data
address = address<<1;
digitalWrite(Max7219_pinCLK,HIGH);
}
}

void Write_Max7219_byte(unsigned char DATA)
{
unsigned char i;
for(i=8;i>=1;i–) //8 to 1 repeat 8 times
{
digitalWrite(Max7219_pinCLK,LOW);
digitalWrite(Max7219_pinDIN,DATA&0x01);// Extracting a bit data
DATA = DATA>>1;
digitalWrite(Max7219_pinCLK,HIGH);
}
}

void Write_Max7219_1(unsigned char address,unsigned char dat1,unsigned char dat2,unsigned char dat3,unsigned char dat4,unsigned char dat5,unsigned char dat6)
{
digitalWrite(Max7219_pinCS_1,LOW);
Write_Max7219_byte_address(address); //address,code of LED
Write_Max7219_byte(dat1); //data,figure on LED
digitalWrite(Max7219_pinCS_1,HIGH);
digitalWrite(Max7219_pinCS_1,LOW);
Write_Max7219_byte_address(address); //address,code of LED
Write_Max7219_byte(dat2); //data,figure on LED
var = 0;
while(var < 2){
Write_Max7219_byte(0);
var++;
}
digitalWrite(Max7219_pinCS_1,HIGH);
digitalWrite(Max7219_pinCS_1,LOW);
Write_Max7219_byte_address(address); //address,code of LED
Write_Max7219_byte(dat3); //data,figure on LED
var = 0;
while(var < 4){
Write_Max7219_byte(0);
var++;
}
digitalWrite(Max7219_pinCS_1,HIGH);
digitalWrite(Max7219_pinCS_1,LOW);
Write_Max7219_byte_address(address); //address,code of LED
Write_Max7219_byte(dat4); //data,figure on LED
var = 0;
while(var < 6){
Write_Max7219_byte(0);
var++;
}
digitalWrite(Max7219_pinCS_1,HIGH);
digitalWrite(Max7219_pinCS_1,LOW);
Write_Max7219_byte_address(address); //address,code of LED
Write_Max7219_byte(dat5); //data,figure on LED
var = 0;
while(var < 8){
Write_Max7219_byte(0);
var++;
}
digitalWrite(Max7219_pinCS_1,HIGH);
digitalWrite(Max7219_pinCS_1,LOW);
Write_Max7219_byte_address(address); //address,code of LED
Write_Max7219_byte(dat6); //data,figure on LED
var = 0;
while(var < 10){
Write_Max7219_byte(0);
var++;
}
digitalWrite(Max7219_pinCS_1,HIGH);
}

void Write_Max7219_2(unsigned char address,unsigned char dat7,unsigned char dat8,unsigned char dat9,unsigned char dat10,unsigned char dat11,unsigned char dat12)
{
digitalWrite(Max7219_pinCS_2,LOW);
Write_Max7219_byte_address(address); //address,code of LED
Write_Max7219_byte(dat7); //data,figure on LED
digitalWrite(Max7219_pinCS_2,HIGH);
digitalWrite(Max7219_pinCS_2,LOW);
Write_Max7219_byte_address(address); //address,code of LED
Write_Max7219_byte(dat8); //data,figure on LED
var = 0;
while(var < 2){
Write_Max7219_byte(0);
var++;
}
digitalWrite(Max7219_pinCS_2,HIGH);
digitalWrite(Max7219_pinCS_2,LOW);
Write_Max7219_byte_address(address); //address,code of LED
Write_Max7219_byte(dat9); //data,figure on LED
var = 0;
while(var < 4){
Write_Max7219_byte(0);
var++;
}
digitalWrite(Max7219_pinCS_2,HIGH);
digitalWrite(Max7219_pinCS_2,LOW);
Write_Max7219_byte_address(address); //address,code of LED
Write_Max7219_byte(dat10); //data,figure on LED
var = 0;
while(var < 6){
Write_Max7219_byte(0);
var++;
}
digitalWrite(Max7219_pinCS_2,HIGH);
digitalWrite(Max7219_pinCS_2,LOW);
Write_Max7219_byte_address(address); //address,code of LED
Write_Max7219_byte(dat11); //data,figure on LED
var = 0;
while(var < 8){
Write_Max7219_byte(0);
var++;
}
digitalWrite(Max7219_pinCS_2,HIGH);
digitalWrite(Max7219_pinCS_2,LOW);
Write_Max7219_byte_address(address); //address,code of LED
Write_Max7219_byte(dat12); //data,figure on LED
var = 0;
while(var < 10){
Write_Max7219_byte(0);
var++;
}
digitalWrite(Max7219_pinCS_2,HIGH);
}

void Init_MAX7219(void)
{
Write_Max7219_1(0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); //decoding :BCD
Write_Max7219_2(0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
Write_Max7219_1(0x0a, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0); //brightness
Write_Max7219_2(0x0a, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0);
Write_Max7219_1(0x0b, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0); //scanlimit;8 LEDs
Write_Max7219_2(0x0b, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0);
Write_Max7219_1(0x0c, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80); //power-down mode:0,normal mode:1
Write_Max7219_2(0x0c, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80);
Write_Max7219_1(0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); //test display:1;EOT,display:0
Write_Max7219_2(0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
}

void setup()
{
Serial.begin(9600);
pinMode(Max7219_pinCLK,OUTPUT);
pinMode(Max7219_pinCS_1,OUTPUT);
pinMode(Max7219_pinCS_2,OUTPUT);
pinMode(Max7219_pinDIN,OUTPUT);
delay(50);
Init_MAX7219();
Serial.print(“Enter a string\n”);
}

void loop()
{
String msg = “”;
if (Serial.available() > 0)
{
while(Serial.available() >0)
{
msg += Serial.read();
delay(250);
}
}
Serial.println(msg);

for(i=1;i<9;i++)
{
Write_Max7219_1(i,disp1[1][i-1],disp1[2][i-1],disp1[3][i-1],disp1[4][i-1],disp1[5][i-1],disp1[6][i-1]);
Write_Max7219_2(i,disp1[7][i-1],disp1[8][i-1],disp1[9][i-1],disp1[10][i-1],disp1[11][i-1],disp1[12][i-1]);

}
}

I know this is very stupid method. Its repeat 12 times to display 12 words. Many thanks if you can help me.

You need more MAX7219 - 1 for 8x8, 2 for 8x16, 16 for 16x64. Then add in Parola library. https://parola.codeplex.com/

I think you need to change

while(var < 8){
var++;
}

to

while(var < 8){
var += coolness;
}

guix:
I think you need to change

while(var < 8){
var++;
}

to

while(var < 8){
var += coolness;
}

coolness??

CrossRoads:
You need more MAX7219 - 1 for 8x8, 2 for 8x16, 16 for 16x64.
Then add in Parola library.
https://parola.codeplex.com/

I have tried Parola library before. But it is too difficult to me.
I don’t understand how the program code run so that I can’t modify the code myself.

Parola_Scrolling_ML.ino (2.91 KB)

Can always have a big array of data, 128 bytes, and just send the data out to the 16 MAX7219s, which are arranged in two rows of 8. First 64 bytes go to the first 8 parts, the second 64 bytes go to the 2nd 8 parts. You can use 16 chip selects and talk to each part individually even, Atmega1284P would bo good for that: MOSI, SCK, 16 chip selects, Rx, Tx, - still have 12 IO free for other things.