Hi, I was working on a class which expect for some pin numbers on int's constructor, but it can be initialized with 1, 2, 3 or 4 pins, depending on what the user's needs.
So I realized to use a constructor with default values, insted of overloaded constructors. And then it appears to be needed a "not_assigned_pin" value, which coud be -1, since there are no negative pin numbers, and most Arduino classes use int as the type for their pins. The constructor then will be something like this:
IR38KHz(const int input_pin,
const int ouput0_pin,
const int ouput1_pin = not_assigned_pin,
const int ouput2_pin = not_assigned_pin,
const int ouput3_pin = not_assigned_pin);
We will declare this constant in our lib as:
const int not_assigned_pin = -1;
which es better than a #define (due to the type checking that it allows to the C++ compiler).
But, now this will be only in our hedader. How about make this a value available in the Arduino Core?
Is there something like this and I did not see it?
Regards,
Juilán
http://robotgroup.com.ar