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
Regarding analog pins, when using Firmata, you won't know the mapping until the configuration query and analog mapping response has returned so I'm not sure how you could use a constant since the mapping of analog pins to digital pins differs per board. Same with constants such as SCL, SDA, etc. The mapping differs by board and there is no way to know what the board from the Firmata client (J5) until you receive a response from the board.