Replies: 1 comment
-
Function overloading and ambiguity. I was having difficulty implementing the 10 overload attach functions (and also other functions with overloads) without getting "ambiguous" errors. This occurred with some of the functions that have the same number of parameters. After doing some research, I found that using int, double, and bool for the parameter types will provide direct matches of type for the compiler without conversion. This allowed it to interpret the overload functions correctly and without error. Example that works and compiles without error: // servo
uint8_t attachServo(int pin);
uint8_t attachServo(int pin, bool invert);
uint8_t attachServo(int pin, int ch);
uint8_t attachServo(int pin, int ch, bool invert);
uint8_t attachServo(int pin, int minUs, int maxUs);
uint8_t attachServo(int pin, int ch, int minUs, int maxUs);
uint8_t attachServo(int pin, int ch, int minUs, int maxUs, bool invert);
uint8_t attachServo(int pin, int minUs, int maxUs, double speed, double ke);
uint8_t attachServo(int pin, int ch, int minUs, int maxUs, double speed, double ke);
uint8_t attachServo(int pin, int ch, int minUs, int maxUs, double speed, double ke, bool invert); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
why did you convert pin typedefs from uint8_t to int on the new V5 library ?
Is it faster on ESP 32 ? Does it use more RAM ?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions