call of overloaded AceButton(int) is ambiguous
joysfera opened this issue · comments
try
#define PIN 0
#include <AceButton.h>
using namespace ace_button;
AceButton button(PIN);
compiler will complain
call of overloaded 'AceButton(int)' is ambiguous
Yeah, it's an unfortunate side-effect of trying to make the constructor a little more flexible and consistent. The C++ compiler cannot distinguish between a nullptr
and 0
. The solution is:
AceButton button((uint8_t) PIN);
or
const uint8_t PIN = 0;
See the Warning section towards the end of https://github.com/bxparks/AceButton#AceButtonClass
[Edit; Add alternate solution using const uint8_t PIN = 0
.]