Switching and porting from Arduino Mega to Teensy 4.1

I realised later that most of the flag images only contain a small number of different colours: red, white, yellow etc. So instead of 3 bytes for each pixel in the SD card files, you could just use 1 character per pixel, encoding 'R' for red, 'W' for white, '.' for black/off and so on. Each file would contain 8 lines of 56 characters. This would mean you could easily create them on the PC using Notepad and save them to the SD card. The Arduino would read the file line by line, column by column and colour the pixel red when it sees an 'R' etc.

Getting more sophisticated, a single file could contain many images (8 rows of 56 characters) in sequence with control codes between them describing how many frames each image should be displayed for, and maybe other commands to control the other led strips. In effect, you would invent your own little 'language' to use inside the file. The Arduino would read the file and execute the sequences of commands in it. The file really would be like the music roll in a player piano.

For example, you might use '@' at the start of a line in the file followed by a number:

@4488

The Arduino would read the '@' and then know to read a number. It would then call waitTO(number)

You might use a '$' like this

$1, 80, 80, 80

The Arduino would read the '$' and know to read 4 numbers after it. It would then call setrgbledpins(1, 80, 80, 80) .