This is my second project on LED matrices, this time the displayed text will be entered using a membrane keyboard. Here we largely use the program from the previous post on LED Matrix with sliding, pre-set text.
The parts needed for the project are:
The program is written so that any number of matrices can be used
Scheme:
Sketch:
#include
#include
int DIN = 12;
int CS = 11;
int CLK = 10;
int number_screens = 2;
//String text = "EXAMPLE TEXT: WWW.ABC-RC.EN";
char after_change;
String caption;
byte ascii_table[130][8];
LedControl lc=LedControl(DIN,CLK,CS,0);
const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
//define the cymbols on the buttons of the keypads
char hexaKeys[ROWS][COLS] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','S','D'}
};
byte rowPins[ROWS] = {9, 8, 7, 6}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {5, 4, 3, 2}; //connect to the column pinouts of the keypad
//initialize an instance of class NewKeypad
Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
void fill()
{
ascii_table[32][0]=B00000000;
ascii_table[32][1]=B00000000;
ascii_table[32][2]=B00000000;
ascii_table[32][3]=B00000000;
ascii_table[32][4]=B00000000;
ascii_table[32][7]=5;
ascii_table[33][0]=B00000000;
ascii_table[33][1]=B01011111;
ascii_table[33][2]=B00000000;
ascii_table[33][7]=3;
ascii_table[34][0]=B00000000;
ascii_table[34][1]=B00001110;
ascii_table[34][2]=B00000000;
ascii_table[34][3]=B00001110;
ascii_table[34][4]=B00000000;
ascii_table[34][7]=5;
ascii_table[35][0]=B00000000;
ascii_table[35][1]=B00010100;
ascii_table[35][2]=B01111111;
ascii_table[35][3]=B00010100;
ascii_table[35][4]=B01111111;
ascii_table[35][5]=B00010100;
ascii_table[35][6]=B00000000;
ascii_table[35][7]=7;
ascii_table[36][0]=B00000000;
ascii_table[36][1]=B00100100;
ascii_table[36][2]=B00101010;
ascii_table[36][3]=B01111111;
ascii_table[36][4]=B00101010;
ascii_table[36][5]=B00100100;
ascii_table[36][6]=B00000000;
ascii_table[36][7]=7;
ascii_table[37][0]=B00000000;
ascii_table[37][1]=B01100010;
ascii_table[37][2]=B01100100;
ascii_table[37][3]=B00001000;
ascii_table[37][4]=B00010011;
ascii_table[37][5]=B00100011;
ascii_table[37][6]=B00000000;
ascii_table[37][7]=7;
ascii_table[38][0]=B00000000;
ascii_table[38][1]=B01010000;
ascii_table[38][2]=B00100010;
ascii_table[38][3]=B01010101;
ascii_table[38][4]=B01001001;
ascii_table[38][5]=B00110110;
ascii_table[38][6]=B00000000;
ascii_table[38][7]=7;
ascii_table[39][0]=B00000000;
ascii_table[39][1]=B00000011;
ascii_table[39][2]=B00000101;
ascii_table[39][3]=B00000000;
ascii_table[39][7]=4;
ascii_table[40][0]=B00000000;
ascii_table[40][1]=B01000001;
ascii_table[40][2]=B00100010;
ascii_table[40][3]=B00011100;
ascii_table[40][4]=B00000000;
ascii_table[40][7]=5;
ascii_table[41][0]=B00000000;
ascii_table[41][1]=B00011100;
ascii_table[41][2]=B00100010;
ascii_table[41][3]=B01000001;
ascii_table[41][4]=B00000000;
ascii_table[41][7]=5;
ascii_table[42][0]=B00000000;
ascii_table[42][1]=B00010100;
ascii_table[42][2]=B00001000;
ascii_table[42][3]=B00111110;
ascii_table[42][4]=B00001000;
ascii_table[42][5]=B00010100;
ascii_table[42][6]=B00000000;
ascii_table[42][7]=7;
ascii_table[43][0]=B00000000;
ascii_table[43][1]=B00001000;
ascii_table[43][2]=B00001000;
ascii_table[43][3]=B00111110;
ascii_table[43][4]=B00001000;
ascii_table[43][5]=B00001000;
ascii_table[43][6]=B00000000;
ascii_table[43][7]=7;
ascii_table[44][0]=B00000000;
ascii_table[44][1]=B00110000;
ascii_table[44][2]=B01010000;
ascii_table[44][3]=B00000000;
ascii_table[44][7]=4;
ascii_table[45][0]=B00000000;
ascii_table[45][1]=B00001000;
ascii_table[45][2]=B00001000;
ascii_table[45][3]=B00001000;
ascii_table[45][4]=B00001000;
ascii_table[45][5]=B00000000;
ascii_table[45][7]=6;
ascii_table[46][0]=B00000000;
ascii_table[46][1]=B01100000;
ascii_table[46][2]=B01100000;
ascii_table[46][3]=B00000000;
ascii_table[46][7]=4;
ascii_table[47][0]=B00000000;
ascii_table[47][1]=B00000010;
ascii_table[47][2]=B00000100;
ascii_table[47][3]=B00001000;
ascii_table[47][4]=B00010000;
ascii_table[47][5]=B00100000;
ascii_table[47][6]=B00000000;
ascii_table[47][7]=7;
ascii_table[48][0]=B00000000;
ascii_table[48][1]=B00111110;
ascii_table[48][2]=B01000001;
ascii_table[48][3]=B01000001;
ascii_table[48][4]=B00111110;
ascii_table[48][5]=B00000000;
ascii_table[48][7]=6;
ascii_table[49][0]=B00000000;
ascii_table[49][1]=B01000000;
ascii_table[49][2]=B01111111;
ascii_table[49][3]=B01000010;
ascii_table[49][4]=B00000000;
ascii_table[49][7]=5;
ascii_table[50][0]=B00000000;
ascii_table[50][1]=B01000110;
ascii_table[50][2]=B01001001;
ascii_table[50][3]=B01010001;
ascii_table[50][4]=B01100011;
ascii_table[50][5]=B01000010;
ascii_table[50][6]=B00000000;
ascii_table[50][7]=7;
ascii_table[51][0]=B00000000;
ascii_table[51][1]=B00110001;
ascii_table[51][2]=B01001011;
ascii_table[51][3]=B01000101;
ascii_table[51][4]=B01000001;
ascii_table[51][5]=B00100001;
ascii_table[51][6]=B00000000;
ascii_table[51][7]=7;
ascii_table[52][0]=B00000000;
ascii_table[52][1]=B00010000;
ascii_table[52][2]=B01111111;
ascii_table[52][3]=B00010010;
ascii_table[52][4]=B00010100;
ascii_table[52][5]=B00011000;
ascii_table[52][6]=B00000000;
ascii_table[52][7]=7;
ascii_table[53][0]=B00000000;
ascii_table[53][1]=B00111001;
ascii_table[53][2]=B01000101;
ascii_table[53][3]=B01000101;
ascii_table[53][4]=B01000101;
ascii_table[53][5]=B00100111;
ascii_table[53][6]=B00000000;
ascii_table[53][7]=7;
ascii_table[54][0]=B00000000;
ascii_table[54][1]=B00110000;
ascii_table[54][2]=B01001001;
ascii_table[54][3]=B01001001;
ascii_table[54][4]=B01001010;
ascii_table[54][5]=B00111100;
ascii_table[54][6]=B00000000;
ascii_table[54][7]=7;
ascii_table[55][0]=B00000000;
ascii_table[55][1]=B00000111;
ascii_table[55][2]=B00001001;
ascii_table[55][3]=B01110001;
ascii_table[55][4]=B00000001;
ascii_table[55][5]=B00000011;
ascii_table[55][6]=B00000000;
ascii_table[55][7]=7;
ascii_table[56][0]=B00000000;
ascii_table[56][1]=B00110110;
ascii_table[56][2]=B01001001;
ascii_table[56][3]=B01001001;
ascii_table[56][4]=B01001001;
ascii_table[56][5]=B00110110;
ascii_table[56][6]=B00000000;
ascii_table[56][7]=7;
ascii_table[57][0]=B00000000;
ascii_table[57][1]=B00011110;
ascii_table[57][2]=B00101001;
ascii_table[57][3]=B01001001;
ascii_table[57][4]=B01001001;
ascii_table[57][5]=B00000110;
ascii_table[57][6]=B00000000;
ascii_table[57][7]=7;
ascii_table[58][0]=B00000000;
ascii_table[58][1]=B00110110;
ascii_table[58][2]=B00110110;
ascii_table[58][3]=B00000000;
ascii_table[58][7]=4;
ascii_table[59][0]=B00000000;
ascii_table[59][1]=B00110110;
ascii_table[59][2]=B01010110;
ascii_table[59][3]=B00000000;
ascii_table[59][7]=4;
ascii_table[60][0]=B00000000;
ascii_table[60][1]=B01000001;
ascii_table[60][2]=B00100010;
ascii_table[60][3]=B00010100;
ascii_table[60][4]=B00001000;
ascii_table[60][5]=B00000000;
ascii_table[60][7]=6;
ascii_table[61][0]=B00000000;
ascii_table[61][1]=B00010100;
ascii_table[61][2]=B00010100;
ascii_table[61][3]=B00010100;
ascii_table[61][4]=B00010100;
ascii_table[61][5]=B00010100;
ascii_table[61][6]=B00000000;
ascii_table[61][7]=7;
ascii_table[62][0]=B00000000;
ascii_table[62][1]=B00001000;
ascii_table[62][2]=B00010100;
ascii_table[62][3]=B00100010;
ascii_table[62][4]=B01000001;
ascii_table[62][5]=B00000000;
ascii_table[62][7]=6;
ascii_table[63][0]=B00000000;
ascii_table[63][1]=B00000110;
ascii_table[63][2]=B00001001;
ascii_table[63][3]=B01010001;
ascii_table[63][4]=B00000001;
ascii_table[63][5]=B00000010;
ascii_table[63][6]=B00000000;
ascii_table[63][7]=7;
ascii_table[64][0]=B00000000;
ascii_table[64][1]=B00111110;
ascii_table[64][2]=B01000001;
ascii_table[64][3]=B01111001;
ascii_table[64][4]=B01001001;
ascii_table[64][5]=B00110010;
ascii_table[64][6]=B00000000;
ascii_table[64][7]=7;
ascii_table[65][0]=B00000000;
ascii_table[65][1]=B01111110;
ascii_table[65][2]=B00010001;
ascii_table[65][3]=B00010001;
ascii_table[65][4]=B00010001;
ascii_table[65][5]=B01111110;
ascii_table[65][6]=B00000000;
ascii_table[65][7]=7;
ascii_table[66][0]=B00000000;
ascii_table[66][1]=B00110110;
ascii_table[66][2]=B01001001;
ascii_table[66][3]=B01001001;
ascii_table[66][4]=B01001001;
ascii_table[66][5]=B01111111;
ascii_table[66][6]=B00000000;
ascii_table[66][7]=7;
ascii_table[67][0]=B00000000;
ascii_table[67][1]=B00100010;
ascii_table[67][2]=B01000001;
ascii_table[67][3]=B01000001;
ascii_table[67][4]=B01000001;
ascii_table[67][5]=B00111110;
ascii_table[67][6]=B00000000;
ascii_table[67][7]=7;
ascii_table[68][0]=B00000000;
ascii_table[68][1]=B00011100;
ascii_table[68][2]=B00100010;
ascii_table[68][3]=B01000001;
ascii_table[68][4]=B01000001;
ascii_table[68][5]=B01111111;
ascii_table[68][6]=B00000000;
ascii_table[68][7]=7;
ascii_table[69][0]=B00000000;
ascii_table[69][1]=B01000001;
ascii_table[69][2]=B01001001;
ascii_table[69][3]=B01001001;
ascii_table[69][4]=B01111111;
ascii_table[69][5]=B00000000;
ascii_table[69][7]=6;
ascii_table[70][0]=B00000000;
ascii_table[70][1]=B00000001;
ascii_table[70][2]=B00001001;
ascii_table[70][3]=B00001001;
ascii_table[70][4]=B01111111;
ascii_table[70][5]=B00000000;
ascii_table[70][7]=6;
ascii_table[71][0]=B00000000;
ascii_table[71][1]=B01111010;
ascii_table[71][2]=B01001001;
ascii_table[71][3]=B01001001;
ascii_table[71][4]=B01000001;
ascii_table[71][5]=B00111110;
ascii_table[71][6]=B00000000;
ascii_table[71][7]=7;
ascii_table[72][0]=B00000000;
ascii_table[72][1]=B01111111;
ascii_table[72][2]=B00001000;
ascii_table[72][3]=B00001000;
ascii_table[72][4]=B01111111;
ascii_table[72][5]=B00000000;
ascii_table[72][7]=6;
ascii_table[73][0]=B00000000;
ascii_table[73][1]=B01000001;
ascii_table[73][2]=B01111111;
ascii_table[73][3]=B01000001;
ascii_table[73][4]=B00000000;
ascii_table[73][7]=5;
ascii_table[74][0]=B00000000;
ascii_table[74][1]=B00000001;
ascii_table[74][2]=B01111111;
ascii_table[74][3]=B01000001;
ascii_table[74][4]=B01000000;
ascii_table[74][5]=B00100000;
ascii_table[74][6]=B00000000;
ascii_table[74][7]=7;
ascii_table[75][0]=B00000000;
ascii_table[75][1]=B01000001;
ascii_table[75][2]=B00100010;
ascii_table[75][3]=B00010100;
ascii_table[75][4]=B00001000;
ascii_table[75][5]=B01111111;
ascii_table[75][6]=B00000000;
ascii_table[75][7]=7;
ascii_table[76][0]=B00000000;
ascii_table[76][1]=B01000000;
ascii_table[76][2]=B01000000;
ascii_table[76][3]=B01000000;
ascii_table[76][4]=B01111111;
ascii_table[76][5]=B00000000;
ascii_table[76][7]=6;
ascii_table[77][0]=B00000000;
ascii_table[77][1]=B01111111;
ascii_table[77][2]=B00000010;
ascii_table[77][3]=B00001100;
ascii_table[77][4]=B00000010;
ascii_table[77][5]=B01111111;
ascii_table[77][6]=B00000000;
ascii_table[77][7]=7;
ascii_table[78][0]=B00000000;
ascii_table[78][1]=B01111111;
ascii_table[78][2]=B00010000;
ascii_table[78][3]=B00001000;
ascii_table[78][4]=B00000100;
ascii_table[78][5]=B01111111;
ascii_table[78][6]=B00000000;
ascii_table[78][7]=7;
ascii_table[79][0]=B00000000;
ascii_table[79][1]=B00111110;
ascii_table[79][2]=B01000001;
ascii_table[79][3]=B01000001;
ascii_table[79][4]=B01000001;
ascii_table[79][5]=B00111110;
ascii_table[79][6]=B00000000;
ascii_table[79][7]=7;
ascii_table[80][0]=B00000000;
ascii_table[80][1]=B00000110;
ascii_table[80][2]=B00001001;
ascii_table[80][3]=B00001001;
ascii_table[80][4]=B00001001;
ascii_table[80][5]=B01111111;
ascii_table[80][6]=B00000000;
ascii_table[80][7]=7;
ascii_table[81][0]=B00000000;
ascii_table[81][1]=B01011110;
ascii_table[81][2]=B00100001;
ascii_table[81][3]=B01010001;
ascii_table[81][4]=B01000001;
ascii_table[81][5]=B00111110;
ascii_table[81][6]=B00000000;
ascii_table[81][7]=7;
ascii_table[82][0]=B00000000;
ascii_table[82][1]=B01000110;
ascii_table[82][2]=B00101001;
ascii_table[82][3]=B00011001;
ascii_table[82][4]=B00001001;
ascii_table[82][5]=B01111111;
ascii_table[82][6]=B00000000;
ascii_table[82][7]=7;
ascii_table[83][0]=B00000000;
ascii_table[83][1]=B00110001;
ascii_table[83][2]=B01001001;
ascii_table[83][3]=B01001001;
ascii_table[83][4]=B01001001;
ascii_table[83][5]=B01000110;
ascii_table[83][6]=B00000000;
ascii_table[83][7]=7;
ascii_table[84][0]=B00000000;
ascii_table[84][1]=B00000001;
ascii_table[84][2]=B00000001;
ascii_table[84][3]=B01111111;
ascii_table[84][4]=B00000001;
ascii_table[84][5]=B00000001;
ascii_table[84][6]=B00000000;
ascii_table[84][7]=7;
ascii_table[85][0]=B00000000;
ascii_table[85][1]=B00111111;
ascii_table[85][2]=B01000000;
ascii_table[85][3]=B01000000;
ascii_table[85][4]=B01000000;
ascii_table[85][5]=B00111111;
ascii_table[85][6]=B00000000;
ascii_table[85][7]=7;
ascii_table[86][0]=B00000000;
ascii_table[86][1]=B00011111;
ascii_table[86][2]=B00100000;
ascii_table[86][3]=B01000000;
ascii_table[86][4]=B00100000;
ascii_table[86][5]=B00011111;
ascii_table[86][6]=B00000000;
ascii_table[86][7]=7;
ascii_table[87][0]=B00000000;
ascii_table[87][1]=B00111111;
ascii_table[87][2]=B01000000;
ascii_table[87][3]=B00111000;
ascii_table[87][4]=B01000000;
ascii_table[87][5]=B00111111;
ascii_table[87][6]=B00000000;
ascii_table[87][7]=7;
ascii_table[88][0]=B00000000;
ascii_table[88][1]=B01100011;
ascii_table[88][2]=B00010100;
ascii_table[88][3]=B00001000;
ascii_table[88][4]=B00010100;
ascii_table[88][5]=B01100011;
ascii_table[88][6]=B00000000;
ascii_table[88][7]=7;
ascii_table[89][0]=B00000000;
ascii_table[89][1]=B00000111;
ascii_table[89][2]=B00001000;
ascii_table[89][3]=B01110000;
ascii_table[89][4]=B00001000;
ascii_table[89][5]=B00000111;
ascii_table[89][6]=B00000000;
ascii_table[89][7]=7;
ascii_table[90][0]=B00000000;
ascii_table[90][1]=B01000011;
ascii_table[90][2]=B01000101;
ascii_table[90][3]=B01001001;
ascii_table[90][4]=B01010001;
ascii_table[90][5]=B01100001;
ascii_table[90][6]=B00000000;
ascii_table[90][7]=7;
ascii_table[91][0]=B00000000;
ascii_table[91][1]=B01000001;
ascii_table[91][2]=B01000001;
ascii_table[91][3]=B01111111;
ascii_table[91][4]=B00000000;
ascii_table[91][7]=5;
ascii_table[93][0]=B00000000;
ascii_table[93][1]=B01111111;
ascii_table[93][2]=B01000001;
ascii_table[93][3]=B01000001;
ascii_table[93][4]=B00000000;
ascii_table[93][7]=5;
ascii_table[94][0]=B00000000;
ascii_table[94][1]=B00000100;
ascii_table[94][2]=B00000010;
ascii_table[94][3]=B00000001;
ascii_table[94][4]=B00000010;
ascii_table[94][5]=B00000100;
ascii_table[94][6]=B00000000;
ascii_table[94][7]=7;
ascii_table[95][0]=B00000000;
ascii_table[95][1]=B01000000;
ascii_table[95][2]=B01000000;
ascii_table[95][3]=B01000000;
ascii_table[95][4]=B01000000;
ascii_table[95][5]=B00000000;
ascii_table[95][7]=6;
ascii_table[123][0]=B00000000;
ascii_table[123][1]=B01000001;
ascii_table[123][2]=B00110110;
ascii_table[123][3]=B00001000;
ascii_table[123][4]=B00000000;
ascii_table[123][7]=5;
ascii_table[124][0]=B00000000;
ascii_table[124][1]=B01111111;
ascii_table[124][2]=B00000000;
ascii_table[124][7]=3;
ascii_table[125][0]=B00000000;
ascii_table[125][1]=B00001000;
ascii_table[125][2]=B00110110;
ascii_table[125][3]=B01000001;
ascii_table[125][4]=B00000000;
ascii_table[125][7]=5;
ascii_table[126][0]=B00000000;
ascii_table[126][1]=B00001000;
ascii_table[126][2]=B00010000;
ascii_table[126][3]=B00001000;
ascii_table[126][4]=B00001000;
ascii_table[126][5]=B00010000;
ascii_table[126][6]=B00000000;
ascii_table[126][7]=7;
}
void setup(){
for (int i=0;i
{
lc.shutdown(i,false); // exit sedation mode
lc.setIntensity(i,1); // setting brightness
lc.clearDisplay(i); // cleaning the screen
}
/*for (int j1=0; j1<90; j1++) //petla to fill ascii
{
for (int i1=0; i1<8; i1++)
{
ascii_table[i1][j1]=0;
}
}*/
}
void loop(){
fill();
read_from_keyboard();
while(customKeypad.getKey()!='D'){ slideAscii(caption);}
inscription="";
}
void printAscii(int screen, int index) //function for fixed text
{
int i = 0;
for(i=0;i<8;i++)
{
lc.setRow(screen,i,ascii_table[index][i]);
delay(50);
}
}
int ile_linei(String text) //function that counts the number of lines to be displayed
{
int numeric[text.length()]; //an array collecting numbers
char char[text.length()]; //character collection array
int lines; // auxiliary variable counting lines
text.toCharArray(char, text.length()+1); //convert string to char array
for (int i=0; i
{
numeric[i]=convert_ascii(char[i]); //convert characters to numbers
lines = lines + ascii_table[numeric[i]][7]; //count how many lines from the 7th ascii field
}
return lines;
}
void slideAscii(String text)
{
int lines = how many_lines(text); //number of lines of text
byte pattern[line+(16*number_screens)]; //the array we will eventually display
int numeric[text.length()]; //fragment copied from function how many_lines
char char[text.length()]; //
text.toCharArray(char, text.length()+1); //
for (int i=0; i
{ //
numeric[i]=change_ascii(char[i]); //
//Serial.println(numeric[i]); //
} //
int counter = 0; //variable counting how many times the loop fills up
for (int k=0;k<(8*number_screens);k++) //filling the first screen in pattern B000000
{
pattern[licznik]=B00000000;
Serial.println(pattern[counter]);
counter++;
}
for (int i=0; i
{ //dependent on the length of the text
//Serial.print("number: ");
//Seriesal.println(i);
for (int j=ascii_table[numeric[i]][7]; j>0;j--) //random from the number of lines in a given character
{
pattern[numeric] = ascii_table[numeric[i]][j-1];
//Seriesal.println(pattern[counter]);
counter++;
}
}
for (int k=0;k<(8*number_screens);k++) //filling the final screen in pattern B000000
{
pattern[licznik]=B00000000;
Serial.println(pattern[counter]);
counter++;
}
for(int k=0;k<(line+(8*number_screens));k++)
{
int lanes=0;
for (int i=0;i
{
for (int j=0;j<8;j++) //internal panel writing on matrix
{
lc.setRow(i,j,pattern[lanes+k]); //lc.setRow print function
lanes++; //pattern is the object we write out
} //passes as this is an additional counting loop
} // +k so that the subtitle can move
delay(30); //delay is the speed at which the text moves
}
}
int replace_ascii(char char) //convert char to ascii
{
if (sign==' '){return 32;}
if (sign=='!'){return 33;}
if (sign=='"'){return 34;}
if (sign=='#'){return 35;}
if (sign=='$'){return 36;}
if (sign=='%'){return 37;}
if (sign=='&'){return 38;}
if (sign=='('){return 40;}
if (sign==')'){return 41;}
if (sign=='*'){return 42;}
if (sign=='+'){return 43;}
if (sign==','){return 44;}
if (sign=='-'){return 45;}
if (sign=='.'){return 46;}
if (sign=='/'){return 47;}
if (sign=='0'){return 48;}
if (sign=='1'){return 49;}
if (sign=='2'){return 50;}
if (sign=='3'){return 51;}
if (sign=='4'){return 52;}
if (sign=='5'){return 53;}
if (sign=='6'){return 54;}
if (sign=='7'){return 55;}
if (sign=='8'){return 56;}
if (sign=='9'){return 57;}
if (sign==':'){return 58;}
if (sign==';'){return 59;}
if (sign=='<'){return 60;}
if (sign=='='){return 61;}
if (sign=='>'){return 62;}
if (sign=='?'){return 63;}
if (sign=='@'){return 64;}
if (sign=='A'){return 65;}
if (sign=='B'){return 66;}
if (sign=='C'){return 67;}
if (sign=='D'){return 68;}
if (sign=='E'){return 69;}
if (sign=='F'){return 70;}
if (sign=='G'){return 71;}
if (sign=='H'){return 72;}
if (sign=='I'){return 73;}
if (sign=='J'){return 74;}
if (sign=='K'){return 75;}
if (sign=='L'){return 76;}
if (sign=='M'){return 77;}
if (sign=='N'){return 78;}
if (sign=='O'){return 79;}
if (sign=='P'){return 80;}
if (sign=='Q'){return 81;}
if (sign=='R'){return 82;}
if (sign=='S'){return 83;}
if (sign=='T'){return 84;}
if (sign=='U'){return 85;}
if (sign=='V'){return 86;}
if (sign=='W'){return 87;}
if (sign=='X'){return 88;}
if (sign=='Y'){return 89;}
if (sign=='Z'){return 90;}
if (sign=='['){return 91;}
if (sign==']'){return 93;}
if (sign=='^'){return 94;}
if (sign=='_'){return 95;}
if (sign=='{'){return 123;}
if (sign=='|'){return 124;}
if (sign=='}'){return 125;}
if (sign=='~'){return 126;}
return 32;
}
void read_from_keyboard()
{
char text[20];
String character[10];
int i=0;
int j=0;
bool end=0;
while (end==0)
{
char customKey = customKeypad.getKey();
if (customKey)
{
text[i] = customKey;
Serial.println("the sign we got");
Serial.println(text[i]);
if (text[i]=='S')
{
end=1;
for (int k=0; k
{
if (sign[k] == "1") {after_swap='.'; inscription += after_change;}
if (sign[k] == "11") { after_change=','; sign += after_change;}
if (sign[k] == "111") {after_change='!'; inscription += after_change;}
if (sign[k] == "1111") {after_swap='?'; inscription += after_change;}
if (sign[k] == "2") { after_change='A'; sign += after_change;}
if (sign[k] == "22") { after_change='B'; sign += after_change;}
if (sign[k] == "222") { after_change='C'; sign += after_change;}
if (sign[k] == "3") { after_change='D'; sign += after_change;}
if (sign[k] == "33") { after_change='E'; sign += after_change;}
if (sign[k] == "333") { after_change='F'; sign += after_change;}
if (sign[k] == "4") { after_change='G'; sign += after_change;}
if (sign[k] == "44") { after_change='H'; sign += after_change;}
if (sign[k] == "444") { after_change='I'; sign += after_change;}
if (sign[k] == "5") { after_change='J'; sign += after_change;}
if (sign[k] == "55") { after_change='K'; sign += after_change;}
if (sign[k] == "555") { after_change='L'; sign += after_change;}
if (sign[k] == "6") { after_change='M'; sign += after_change;}
if (sign[k] == "66") { after_change='N'; sign += after_change;}
if (sign[k] == "666") { after_change='O'; sign += after_change;}
if (sign[k] == "7") { after_change='P'; sign += after_change;}
if (sign[k] == "77") { after_change='Q'; sign += after_change;}
if (sign[k] == "777") { after_change='R'; sign += after_change;}
if (sign[k] == "7777") { after_change='S'; sign += after_change;}
if (sign[k] == "8") { after_change='T'; sign += after_change;}
if (sign[k] == "88") { after_change='U'; sign += after_change;}
if (sign[k] == "888") { after_change='V'; sign += after_change;}
if (sign[k] == "9") { after_change='W'; sign += after_change;}
if (sign[k] == "99") { after_change='X'; sign += after_change;}
if (sign[k] == "999") { after_change='Y'; sign += after_change;}
if (sign[k] == "9999") { after_change='Z'; sign += after_change;}
if (sign[k] == "A") { after_change='1'; sign += after_change;}
if (sign[k] == "AA") { po_change='2'; sign += po_change;}
if (sign[k] == "AAA") { po_change='3'; sign += po_change;}
if (sign[k] == "B") { po_change='4'; sign += po_change;}
if (sign[k] == "BB") { po_change='5'; sign += po_change;}
if (sign[k] == "BBB") { po_change='6'; sign += po_change;}
if (sign[k] == "C") { after_change='7'; sign += after_change;}
if (sign[k] == "CC") { after_change='8'; sign += after_change;}
if (sign[k] == "CCC") { after_change='9'; sign += after_change;}
if (sign[k] == "0") { after_change=' '; sign += after_change;}
if (sign[k] == "00") { after_change='0'; sign += after_change;}
}
Serial.println("array after swap:");
/* for (int k=0; k
{
Serial.print(po_change[k]);
}*/
Serial.println("");
Serial.println("caption:");
Serial.println(subtitle);
}
if (text[i]=='*')
{
j++;
i=0;
}
else
{
Serial.print("mark[");
Serial.print(j);
Serial.println("]");
znak[j]=znak[j]+tekst[i];
Serial.println(sign[j]);
i++;
}
Serial.println("array obtained");
for (int k=0; k
{
Serial.println(sign[k]);
}
Serial.println("");
}
}
}
The whole thing is clearly explained in the video:
https://www.youtube.com/watch?v=VOWYsQDwFF0
Recommended: