I am a Java guy trying to write some stuff in C++ for an Arduino project I have. What I've got is a matrix of LED lights which I am trying to draw letters on. I have setup a 2D array for each character, and now am trying to create a function that will draw the proper character on the LED board in a given position.
For example, I have defined,
boolean y[8][5]={
{1,0,0,0,1},
{0,1,0,1,0},
{0,1,0,1,0},
{0,0,1,0,0},
{0,0,1,0,0},
{0,0,1,0,0},
{0,0,1,0,0},
{0,0,1,0,0}};
Then ideally, I would like to have a function that takes a single character input and the x,y position of where the character should be placed in the light array.
However, I can't find a way to get the function to select the proper 2D array. I tried if statements, where
if(charIn=='y'){
charMap={
{1,0,0,0,1},
{0,1,0,1,0},
{0,1,0,1,0},
{0,0,1,0,0},
{0,0,1,0,0},
{0,0,1,0,0},
{0,0,1,0,0},
{0,0,1,0,0}};;
}
but then when I actually want to use charMap, it says it has not been created...even with a catchall else statement that guarantees its creation.
Any ideas for how I can get the function to recognize which 2D array it needs to use based upon an input character?