Sent from my Android phone with K-9 Mail. Please excuse my brevity. --
Using LED_BUILTIN in the examples
tends to "abstract" the LED as kind of an object (a good thing).
The "should be" , "almost every board" along with the
chip pin 13 ( verses D13 ) (D9 on the ethernet ! Not present on mini )
is exactly why examples should not include the confusion.
Isn't D13 also used for SCLK (on the Uno?)
With all respect to Tom and Dave, I think you are so well versed in this area as to
forget how things were when you were new to the environment.
Please review my original post and reconsider.
Sincerely,
Dennis German
In data domenica 3 novembre 2013 18:57:37, Cristian Maglie ha scritto:
> that transforms the LED_BUILTIN from a const variable to a macro as
> suggested here:
>
> https://github.com/arduino/Arduino/issues/758
>
> C
Well, thinking on that, currently there is no reason to have only the LED_BUILTIN as a macro, as pointed out here:
https://github.com/arduino/Arduino/issues/758#issuecomment-29158034
so if there are no concerns I'm preparing a patch to change also the other pin constants to a macro.
C
> Well, thinking on that, currently there is no reason to have only the
> LED_BUILTIN as a macro, as pointed out here:
>
> https://github.com/arduino/Arduino/issues/758#issuecomment-29158034
>
> so if there are no concerns I'm preparing a patch to change also the other
> pin constants to a macro.
Looking again on this one changing
const int MISO = xxx;
to
#define MISO xxx
have a subtle side effect, for example the following code:
https://github.com/adafruit/Adafruit-MAX31855-library/blob/master/Adafruit_MAX31855.h#L26
declares parameters name as "MISO", but since we #define MISO to something else, the code is screwed up, an produce errors like the following:
sketch_ac_ino:44: error: no matching function for call to 'Adafruit_MAX31855::Adafruit_MAX31855(int, int, int)'
C:\Users\JSweda\Documents\Arduino\libraries\Adafruit_MAX31855/Adafruit_MAX31855.h:24:
note: candidates are: Adafruit_MAX31855::Adafruit_MAX31855()
note: Adafruit_MAX31855::Adafruit_MAX31855(const Adafruit_MAX31855&)
The same doesn't happen with the const int declaration (since the local name "hides" the global one).
Any idea?
C
All caps variable names are frequently a bad idea but not uncommon. What if we went with something like
#define _MISO_ ...
Local variable beginning or ending with underscores is even worse than all caps.
--