Warning, analogRead can break SmartMatrix output


#1

This is now the 2nd time I spend hours debugging why SmartMatrix is looking wrong.
First time I had output that was overwritten due to an address line that was being ignored.
Second time, I got no output at all because the corrupted line was the latch pin.

Both times, the code I was using had one of those:
//randomSeed(analogRead(14));
This one happens to be in AnimatedGifs.
It’s well meaning, but if it happens to hit one of the 14 pins you’re using for SmartMatrix output, you’re going to have a bad time (more or less depending on what pin is hit).
Seems that on ESP32, doing analogRead also runs pinMode input to be helpful, preventing that pin from being used as output after that, breaking the SmartMatrix driver.


AnimatedGif example: remove random
#2

There are probably better ways of seeding the random number generator. I created a GitHub issues for this: https://github.com/pixelmatix/AnimatedGIFs/issues/25