...but I would like to know why the "indef" is written with morse_h instead of morse.h??
It is not "indef", it is "ifndef".
#ifndef can be write as #if not defined
It is written as morse_h because you aren't defining the file name, but rather an flag.
So, this code:
#ifndef morse_h
#define morse_h
/* code */
#endif
Can be read as:
If the flag morse_h is not defined, define it and make available the code inside the #if.
If the flag morse_h is already defined, then the code inside the #if won't be available.
It is explicit using the underscore, so it can't be confused with the file.
#ifndef Morse_h
Checks if the flag Morse_h is defined.
See, it doesn't check the if the file is defined, so the name of the flag must be different.
#define Morse_h
This define the flag Morse_h
Again, it must be different from the file name, because it would mean that you are defining the file, but you are just defining a flag.
The names are similar to indicate that this #if is related to the "Include Guard" of Morse.h.
It's a convention. You could call it "MorseDotH_FileExists" instead of "Morse_h" if that makes more sense to you. You can not use a period in the identifier because:
Only alphabetic characters, digits and underscore (_) are permitted in C++ language for declaring identifier.
aarg:
It's a convention. You could call it "MorseDotH_FileExists" instead of "Morse_h" if that makes more sense to you. You can not use a period in the identifier because:
Thanks for sharing this!
Just now I tested with the period in the Include Guard, and I got no errors while compiling and uploading. Maybe it's the Arduino IDE particular characteristic?