The Arduino programming environment is bootstrapped with many preprocessor definition contant values, specifically created to make the programming experience more accessible to non-programmers. Some specific examples include:
- Analog Pins:
A0
: 14A1
: 15
- Modes:
INPUT
: 0OUTPUT
: 1
- Values:
HIGH
: 1LOW
: 0
Please post thoughts in the comments. I'd like to flesh out the lists below before making a decision.
- Easily memorized by users
- Increased accessibility for those familiar with Arduino IDE programming
- Potentially reduce user code errors (?)
- Global scope pollution
Compare the pins_arduino.h file you referenced for the standard (ATMega328) arduino variant to the pins_arduino.h file for the Arduino Leonardo and the Arduino Mega and you'll see how the mappings are not consistent across boards. It would be safe to create (namespaced) global constants for things like pin modes and common values (HIGH / LOW) but that's probably about it.