I am a Arduino beginner and I have a little C++ experience. My question is why does the Arduino projects book make all variables global?
The const global variables I get because they are used in setup and loop. The thing that confuses me is the use of regular global variables. My understanding is this is a no-no(?). I see why it's done this way but would using static variables be a better idea?
I know how both types of variables work I'm just a little lost as to why the project book is doing this. Is there a reason that is Arduino specific that I'm just not aware of? Thanks!
It's a well-established coding best practice to limit variable scope to the minimum required. Especially for a large project that you hope to be able to maintain.