I would like to ask about a weirdness in my program. This is my program:
void setup() {
Serial.begin(9600);
}
void loop() {
workout_Text();
}
void workout_Text() {
int woT_x[] = {1, 4, 8, 12, 16};
int woT_y[] = {1, 4, 8, 12, 16};
int n = sizeof(woT_y);
on_led(woT_x, woT_y, n);
}
void on_led(int a_mat[], int b_mat[], int m) {
for (int i = 0; i < m; i++) {
Serial.print(a_mat[i]);
Serial.print(" : ");
Serial.println(b_mat[i]);
delay(100);
}
}
This is the part of my program for a LED matrix. The on_led purpose
function is for printing the value of a_mat
and b_mat
. Instead of printing:
1 : 1
4 : 4
8 : 8
12 : 12
16 : 16
1 : 1
4 : 4
8 : 8
16 : 16
It prints:
1 : 1
4 : 4
8 : 8
12 : 12
16 : 16
13312 : 1
23296 : 4
1 : 8
4 : 12
8 : 16
1 : 1
4 : 4
8 : 8
Where does the big number come from? I am sure that my code is right to just print the a_mat
and b_mat
.
Thank you.