People, I'm back with a P10 panel and an arduino uno. When a single counter reaches 0, I display a STOP message that scrolls across the panel. But I would like to show STOP + int x which is equal to 10. So it will scroll like this on the panel:
Is better not to use the message as const and avoid pointers. Use index of char instead.
int x = 10;
char msg[50]; // Set enough length to avoid buffer overflow
sprintf(msg ," STOP %d ", x);
if (counter == 0) {
for (int n = 0; n < strlen(msg); n++) {
box1.print(msg[n]);
delay(120)
}
}
Just one more tip, is good practise to not create variables inside "if" and others conditionals.
Well this is a simple snipper, but with codes with many lines, if you end up adding an else stament for a new feature/improvement and "maybe" you need this variable, is a waste of time.