Break up small array into bigger array in arduino for a braile application

  arduino, arduino-c++, arduino-ide, c++

i do not tend to use arduino that much, but this time i am getting stuck on this part.

What im trying to do is a braile translator for a friend of mine wich has disabilities and Visual impairment. Each collumn of this array will have a perforation when it encounters a 1

int arr[][50] = {
  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};

this is my array wich will store all the dots, meaning that 1 its a dot and 0 its a space
my intended result for i dont know String str_in="A B C"
should be

int arr[][50] = {
  { 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};

Every two characters is supposed to be the letter.
But i can only add one letter into the array its replacing the contents and always end in the end letter " C " for example , iknow its probably a wrong for syntax. but i tried many ways withouth any luck.
i have this method to copy on the Loop body of the code the translated letters into my main array.

void copiar(int jj[][2])
{
  for (int letra = 0; letra < 50;) {
    for (int i = 0; i < 3; i++)
      for (int j = 0; j < 2; j++)
        arr[i][letra] = jj[i][j];
    letra = letra + 2;
  }
}

and to translate each braile character im using this method to translate each letter of a string giving the case of the letter.

void MatrixB(char a)
{
    switch (a) {
        case 'a': {
                int k[][2] = { { 1, 0 }, { 0, 0 }, { 0, 0 } };
                copiar(k);
            } break;
            
        case 'b': {
                int k[][2] = { { 1, 0 }, { 1, 0 }, { 0, 0 } };
                copiar(k);
            } break;
            
        case 'c': {
                int k[][2] = { { 1, 1 }, { 0, 0 }, { 0, 0 } };
                copiar(k);
            } break;
            
        case 'd': {
                int k[][2] = { { 1, 1 }, { 0, 1 }, { 0, 0 } };
                copiar(k);
            } break;
            
        case 'e': {
                int k[][2] = { { 1, 0 }, { 0, 1 }, { 0, 0 } };
                copiar(k);
            } break;
            
        case 'f': {
                int k[][2] = { { 1, 1 }, { 1, 0 }, { 0, 0 } };
                copiar(k);
            } break;
            
        case 'g': {
                int k[][2] = { { 1, 1 }, { 1, 1 }, { 0, 0 } };
                copiar(k);
            } break;
            
        case 'h': {
                int k[][2] = { { 1, 0 }, { 1, 1 }, { 0, 0 } };
                copiar(k);
            } break;
            
        case 'i': {
                int k[][2] = { { 0, 1 }, { 1, 0 }, { 0, 0 } };
                copiar(k);
            } break;
            
        case 'j': {
                int k[][2] = { { 0, 1 }, { 1, 1 }, { 0, 0 } };
                copiar(k);
            } break;
            
        case 'k': {
                int k[][2] = { { 0, 1 }, { 0, 0 }, { 1, 0 } };
                copiar(k);
            } break;
            
        case 'l': {
                int k[][2] = { { 1, 0 }, { 1, 0 }, { 1, 0 } };
                copiar(k);
            } break;
            
        case 'm': {
                int k[][2] = { { 1, 1 }, { 0, 0 }, { 1, 0 } };
                copiar(k);
            } break;
            
        case 'n': {
                int k[][2] = { { 1, 1 }, { 0, 1 }, { 1, 0 } };
                copiar(k);
            } break;
            
        case 'o': {
                int k[][2] = { { 1, 0 }, { 0, 1 }, { 1, 0 } };
                copiar(k);
            } break;
            
        case 'p': {
                int k[][2] = { { 1, 1 }, { 1, 0 }, { 1, 0 } };
                copiar(k);
            } break;
            
        case 'q': {
                int k[][2] = { { 1, 1 }, { 1, 1 }, { 1, 0 } };
                copiar(k);
            } break;
            
        case 'r': {
                int k[][2] = { { 1, 0 }, { 1, 1 }, { 1, 0 } };
                copiar(k);
            } break;
            
        case 's': {
                int k[][2] = { { 0, 1 }, { 1, 0 }, { 1, 0 } };
                copiar(k);
            } break;
            
        case 't': {
                int k[][2] = { { 0, 1 }, { 1, 1 }, { 1, 0 } };
                copiar(k);
            } break;
            
        case 'u': {
                int k[][2] = { { 1, 0 }, { 0, 0 }, { 1, 1 } };
                copiar(k);
            } break;
            
        case 'v': {
                int k[][2] = { { 1, 0 }, { 0, 0 }, { 0, 0 } };
                copiar(k);
            } break;
            
        case 'w': {
                int k[][2] = { { 1, 0 }, { 0, 0 }, { 0, 0 } };
                copiar(k);
            } break;
            
        case 'x': {
                int k[][2] = { { 1, 0 }, { 0, 0 }, { 0, 0 } };
                copiar(k);
            } break;
            
        case 'y': {
                int k[][2] = { { 1, 0 }, { 0, 0 }, { 0, 0 } };
                copiar(k);
            } break;
            
        case 'z': {
                int k[][2] = { { 1, 0 }, { 0, 0 }, { 0, 0 } };
                copiar(k);
            } break;
    }
}

my loop body has this MatrixB function declared, so each time it encounters a letter it will add it to my main array arrusing Copiar() method
my loop body looks like this.

void loop() {
    for (int i = 0; i <= in_str.length() - 1; i++) {
        if (String(in_str.charAt(i)) != " ") {
            
            MatrixB(toLowerCase(in_str.charAt(i)));
            printA(arr);
            delay(200);
        }
        else if (String(in_str.charAt(i)) == " ") {
            Serial.println("Aqui va un espacio");
        }
    }
    //printA(arr);
    delay(500);
}

the sheet of paper has a limit of 50 characters thats why im doing an array that big. and also because i dont have any idea if there is any other way.

im not expert in arduino code nor C++, so any kind of direction and help will be helpful

Source: Windows Questions C++

LEAVE A COMMENT