Closed jtwalters closed 8 years ago
I'm not sure the pinMode is not necessary, can you provide a reference to documentation?
Regarding the namespace, while I do like the approach, I believe not many Arduino users are used to namespaces: why would the namespace usage improve on using both libraries together?
Here's a related thread that explains why pinMode is unnecessary for analogRead.
The namespace helps because I'm using another library (named Button) that has a class named Button with a different interface. It confuses the compiler and I'm unable to use both Button classes at once, since neither libraries are namespaced.
Almost a year later, apologies... I suggest you add the namespace in your copy, I prefer this not to be the only namespaced library around.
With regards to the pinMode
setting, it's correct in terms of being unnecessary, but it is executed only once and allows to chose between INPUT
and INPUT_PULLUP
, so I believe the overhead is ok compared to making the library user think about what they are doing.
For analogRead, you don't have to specify a pin mode.
Not tested (yet). But, I wanted to get your feedback.
Since there's another Button arduino library, the namespace will allow both to be used in the same sketch.