Hello,
I am trying to make a code that creates a string array that I can then convert to a char array using toCharArray to pass through an 8x8 LED matrix. I currently have the following code to try and take the input message and parse through it (using for and if loops) to add the correct series of bits to create a scrolling message on the LED matrix. While I was coding before, I had it working (testing only on Serial moniter) however, I had forgotten to close of the if statement and now that the if statement is closed, I am getting random garbage on the Serial moniter rather than my string arrays. Can you help?
char input_message[] = "AB"; //INSERT input_message HERE
String message[7] = {"","","","","","",""};
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
Serial.println(sizeof(input_message));
// put your main code here, to run repeatedly:
for (int i = 0; i < sizeof(input_message)-1; i ++) {
if (input_message[i] == 'A') {
for (int j = 0; j < 7; j ++) {
for (int k = 0; k < 6; k++) {
message[j] = message[j] + String(A[j][k]);
}
}
}
if (input_message[i] == 'B') {
for (int j = 0; j < 7; j ++) {
for (int k = 0; k < 6; k++) {
message[j] = message[j] + String(B[j][k]);
}
}
}
if (input_message[i] == 'C') {
for (int j = 0; j < 7; j ++) {
for (int k = 0; k < 6; k++) {
message[j] = message[j] + String(C[j][k]);
}
}
}
if (input_message[i] == 'D') {
for (int j = 0; j < 7; j ++) {
for (int k = 0; k < 6; k++) {
message[j] = message[j] + String(D[j][k]);
}
}
}
char A[7][6] = {"011100", "100010", "100010", "111110", "100010", "100010", "100010"};
char B[7][6] = {"111100", "100010", "100010", "111100", "100010", "100010", "111100"};
char C[7][6] = {"011100", "100010", "100000", "100000", "100000", "100010", "011100"};
char D[7][6] = {"111100", "100010", "100010", "100010", "100010", "100010", "111100"};
sketch_mar30a.ino (11.3 KB)