Hello,
I’m currently trying to write some small exercises for teenagers and something went wrong with the last bit of code I’m testing. I have the LED matrix available and want the robot to print numbers from 1 to 10 on the matrix then have the onboard LEDs blinking and I can’t seem to do it.
This is my code:
void loop() {
for (int num = 0; num <= 10; num++) {
matrix.showNum(num);
delay(500);
}
while (1) {
leds.setColor(255, 0, 0);
leds.show();
delay(500);
leds.setColor(0, 0, 0);
leds.show();
delay(500);
}
}
The program does enter the loop because the number on the matrix stays stuck at 10. I tried changing the condition from always true to an integer incrementing up until 10, the number on the matrix goes back to 0 after 10 secondes. So it appears that everything works fine except the LEDs instructions.
If I comment the for, its instructions, the while, and let only the blinking code, it works perfectly.
If I write another instruction in the while, this instruction works (I tried matrix.showNum(100))
If I write matrix.showNum(100); followed by only the leds.setColor(255, 0, 0); leds.show(); in the while, the LEDs do light up in red.
If I write the thing just above and put a leds.setColor(0, 0, 0); leds.show(); as the first instruction of the code, the LEDs still light up in red but never turn off.
I may have tried other combinations but I don’t remember them right off the bat. The point is it’s all acting really weird. Does the LED matrix get in conflict with the onboard LEDs or something? That is my last idea at that point