Arduino.h
defines LOW
as 0x0
and HIGH
as 0x1
. Does the Arduino API intend to expose that fact? Does it guarantee that this will always be that way?
In other words, what is the intended purpose of these manifest constants: LOW
and HIGH
?
Is this purely cosmetic mnemonics added as an alternative for
0/1
andfalse/true
, for those who likeLOW/HIGH
better?Or is this an attempt to abstract/isolate the user's source code from the actual representation of
LOW
andHIGH
(e.g. in case the representation changes in the future)?
The underlying reason for this question is to figure out whether code like
digitalWrite(some_pin, true);
digitalWrite(some_other_pin, !digitalRead(some_other_pin));
is a good programming practice. (If LOW
and HIGH
are there to abstract the user's code form their actual values then code like that is definitely a bad programming practice.)
0xFF
as a potential definition ofHIGH
, so point 2 may be the case... – jose can u c Apr 26 at 19:12