Hello, Im working on a proyect to show letters, but I cant add the code for the bluetooth this the code:
const int data1 = 2; // frist shift register's pins
const int str1 = 3; // the storge register (latch pin) of the all the three shift registers are connected together
const int clock1 = 4; //
const int data2 = 5; // second shift register's pins
const int clock2 = 6; //
////////////////////////////////////////////////////////////////////////////////////// BELOW ARE THE REFERENCE ARRAYS FOR APLHABETS, NUMBERS and CHARACTERS.
const int aa[6] = {B00000000, B01111110, B10001000, B10001000, B10001000, B01111110 }; //// ALPHABETS
const int bb[6] = {B00000000, B11111110, B10010010, B10010010, B10010010, B01101100 };
const int cc[6] = {B00000000, B01111100, B10000010, B10000010, B10000010, B01000100 };
const int dd[6] = {B00000000, B11111110, B10000010, B10000010, B10000010, B01111100 };
const int ee[6] = {B00000000, B11111110, B10010010, B10010010, B10010010, B10000010 };
const int ff[6] = {B00000000, B11111110, B10010000, B10010000, B10010000, B10000000 };
const int gg[6] = {B00000000, B01111100, B10000010, B10000010, B10001010, B01001100 };
const int hh[6] = {B00000000, B11111110, B00010000, B00010000, B00010000, B11111110 };
const int ii[6] = {B00000000, B00000000, B10000010, B11111110, B10000010, B00000000 };
const int jj[6] = {B00000000, B00000100, B00000010, B10000010, B11111100, B10000000 };
const int kk[6] = {B00000000, B11111110, B00010000, B00101000, B01000100, B10000010 };
const int ll[6] = {B00000000, B11111110, B00000010, B00000010, B00000010, B00000010 };
const int mm[6] = {B00000000, B11111110, B01000000, B00110000, B01000000, B11111110 };
const int nn[6] = {B00000000, B11111110, B00100000, B00010000, B00001000, B11111110 };
const int oo[7] = {B00000000, B01111100, B10000010, B10000010, B10000010, B01111100 };
const int pp[6] = {B00000000, B11111110, B10010000, B10010000, B10010000, B01100000 };
const int qq[6] = {B00000000, B01111100, B10000010, B10001010, B10000100, B01111010 };
const int rr[6] = {B00000000, B11111110, B10010000, B10011000, B10010100, B01100010 };
const int ss[6] = {B00000000, B01100010, B10010010, B10010010, B10010010, B10001100 };
const int tt[6] = {B00000000, B10000000, B10000000, B11111110, B10000000, B10000000 };
const int uu[6] = {B00000000, B11111100, B00000010, B00000010, B00000010, B11111100 };
const int vv[6] = {B00000000, B11111000, B00000100, B00000010, B00000100, B11111000 };
const int ww[6] = {B00000000, B11111100, B00000010, B00011100, B00000010, B11111100 };
const int xx[6] = {B00000000, B11000110, B00101000, B00010000, B00101000, B11000110 };
const int yy[6] = {B00000000, B11100000, B00010000, B00001110, B00010000, B11100000 };
const int zz[6] = {B00000000, B10000110, B10001010, B10010010, B10100010, B11000010 };
const int n0[6] = {B11111111, B10000011, B01111101, B01111101, B01111101, B10000011 }; //// NUMBERS
const int n1[6] = {B11111111, B11111111, B10111101, B00000001, B11111101, B11111111 };
const int n2[6] = {B11111111, B10111001, B01110101, B01101101, B01011101, B10111101 };
const int n3[6] = {B11111111, B10111011, B01111101, B01101101, B01101101, B10010011 };
const int n4[6] = {B11111111, B11100111, B11010111, B10110111, B00000001, B11110111 };
const int n5[6] = {B11111111, B00011011, B01101101, B01101101, B01101101, B01110011 };
const int n6[6] = {B11111111, B10010011, B01101101, B01101101, B01101101, B11110011 };
const int n7[6] = {B11111111, B01111111, B01110001, B01101111, B01011111, B00111111 };
const int n8[6] = {B11111111, B10010011, B01101101, B01101101, B01101101, B10010011 };
const int n9[6] = {B11111111, B10011111, B01101101, B01101101, B01101101, B10010011 };
const int sp[6] = {B00000000, B00000000, B00000000, B00000000, B00000000, B00000000 }; // SPACE ' '
const int ex[5] = {B11111111, B11111111, B00000101, B11111111, B11111111 }; // EXCLAMATION MARK '!'
const int qu[6] = {B11111111, B10111111, B01111111, B01110101, B01101111, B10011111 }; // QUESTION MARK '?'
const int mi[6] = {B11111111, B11101111, B11101111, B11101111, B11101111, B11101111 }; // MINUS '-'
const int co[6] = {000000000, B00000000, B00000000, B01000100, B00000000, B00000000 }; // COLON ':'
const int bs[6] = {B11111111, B11111111, B11111111, B10000011, B01111101, B11111111 }; // BRACKET START '('
const int be[6] = {B00000000, B00000000, B10000010, B01111100, B00000000, B00000000 }; // BRACKET END ')'
byte d[] = {B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111,
B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111,
B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111,
B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111}; // the display matrix.
int e,g,i;
int f = 1;
int m = 0;
int k = 6;
unsigned long t;
char alp ;
char text[] = {"HELLO"}; ////////// WRITE TEXT HERE //////////
char line[200];
void setup()
{
pinMode(data1,OUTPUT);
pinMode(str1,OUTPUT);
pinMode(clock1,OUTPUT);
pinMode(data2,OUTPUT);
pinMode(clock2,OUTPUT);
Serial.begin(9600);
}
void loop()
{
if(millis()-t>20) // 60 is the scrolling speed in milliseconds.
{
t = millis();
for(g=23; g>=0; g--) // this loop shifts all the bytes in the array 'd' by one place.
d[g] = d[g-1];
if(f==k) // (first read the three comment lines below to understand this) if f==k then read the next char in the string!
{
k = k + 6; // almost every alphabet/number is made with a size 6 array, 'k' enables the program (the variable f)
// to read only a single reference array (means one character from text) till it is completely read
m = m + 1; // then it selects next character by incrementing the value of a variable 'm'(m starts with 0 to read the first char in text string)
}
if(f<k) // else continue reading the reference array of the selected char in the text string untill it is completely read.
{
alp = text[m]; // alp is a char variable which holds the selected char in the text string for six incremented values of 'f'.
array(f-6m); // array is a function at the bottom, f is incremented by one every 60 milliseconds so it continues to be incremented to values
} // greater than 6 which is the size of the reference arrays. (f-6m) always ranges from 0 to 5.
f++;
}
for(e=0; e<24; e++) // display loop.
{
byte a = 0; // writes a 'one' on the 'e'th position of the byte 'a' this is to make a running one in the coloumns as we controll the rows.
if(e<8)
bitSet(a,e);
if((e>=8)&&(e<16))
bitSet(a,e-8);
if((e>=16)&&(e<24))
bitSet(a,e-16);
digitalWrite(str1,LOW);
shiftOut(data1,clock1,LSBFIRST,d[e]); // shifts out the main display array 'd[]' which controlles the rows
if(e<8)
{
shiftOut(data2,clock2,LSBFIRST,a); // shift the 'walking one' to first shift register
shiftOut(data2,clock2,LSBFIRST,0);
shiftOut(data2,clock2,LSBFIRST,0);
}
if((e>=8)&&(e<16))
{
shiftOut(data2,clock2,LSBFIRST,0); // shift the 'walking one' to second shift register
shiftOut(data2,clock2,LSBFIRST,a);
shiftOut(data2,clock2,LSBFIRST,0);
}
if((e>=16)&&(e<24))
{
shiftOut(data2,clock2,LSBFIRST,0); // shift the 'walking one' to third shift register
shiftOut(data2,clock2,LSBFIRST,0);
shiftOut(data2,clock2,LSBFIRST,a);
}
digitalWrite(str1,HIGH);
}
}