I am confused about how capitalization affects Arduino code and what “void” does and what is in scope. I have read a bit on the subjects but am still confused and can’t find an answer on the capitalization issues.
I am working through the examples in the book Exploring Arduino written by Jeremy Blum. In working with Chapter 2, program Listings 2-5 and 2-6, I created the following errors.
In the beginning of the Arduino Sketch I have the following:
boolean ledOn=false; //Variable re the present state of the LED (on/off)
The last line of the sketch in the void loop section of the sketch I had the following:
digitalWrite(LED, LedOn); //for some reason the error I got here seemed to be the capital letter L used in LedOn
I had mistakenly capitalized the l in ledOn in the final line of code. The error I got was “LedOn” was not declared in this scope.
I made a similar error in my next sketch I worked on:
In the beginning of the sketch I had the following:
boolean ledMode=0; //Variable cycle between LED states.
In the setup section I had the following:
void setMODE(int mode)
At the end of the sketch I had the following:
The error I got was “setMode” was not declared in this scope.
The fix was to match the capitalization of “mode” in setmode. (I note that the first setMode function sets “mode” and following that there are a number of references to mode. If I change the capitalization of any of those “mode”s I get the same type of error. I ask, why does it matter? Perhaps more importantly where can I find more materials to read and learn more about this so I understand better how and why this all works.
Thank you for any helpful suggestions.