[Solved!] Trying to understand my own working code

To make things worse, I no longer have access to an Arduino, so I can't make experiments with the code

It is easy to remedy that situation! An Arduino Pro Mini clone costs about $1 on eBay, and they always seem to work.