Hello,
I'm not sure if this is still being maintained since it looks like it's been a while since it's been touched.
I'm having an issue using when using this library with multiple instances of the class AnalogMultiButton. The way my circuit is set up, I've grouped buttons in groups of 3-5 in order to keep everything modular but still minimize pin usage. If I set this up for one set of buttons and declare one instance similarly to the example, it works perfect.
Now, if I create multiple instances of the class, eg:
AnalogMultiButton xyButton = AnalogMultiButton(XY_AXIS_BUT,XY_But_Total,setptxy,80);
AnalogMultiButton zButton = AnalogMultiButton(Z_AXIS_BUT,Z_But_Total,setpt3,80);
AnalogMultiButton setButton = AnalogMultiButton(SET_AXIS_BUT,Set_But_Total,setpt3,80);
AnalogMultiButton miscButton = AnalogMultiButton(MISC_BUT,Misc_But_Total,setpt3,80);
And then in my loop(), update all four sets:
xyButton.update();
zButton.update();
setButton.update();
miscButton.update();
And setup if statements below for each one as shown in the example...
When pressing one of the buttons, it will perform the action assigned to all buttons with a matching voltage rating, regardless of pin. For example, if i have a circuit with 3 buttons on it attached only to A3 (with code setup to differing actions for A0,A1, and A2 but those pins not connected). And I push button (2) of 3, it will properly perform the button (2) action. However it will also perform the button (2) action for the A0, A1, A2 pins even though they are not being triggered.
Now, if I turn off all the other updates and only .update() one pin, it will work correctly and I can switch which pin I update and maintain proper function. So there is only disfunction if i .update() more than one pin (which is obviously required if I'm going to have more than one set of buttons). It's as if when another instance of the class is updated, the state variables within the class are getting shared/overwritten, causing downstream problems.
Hello,
I'm not sure if this is still being maintained since it looks like it's been a while since it's been touched.
I'm having an issue using when using this library with multiple instances of the class AnalogMultiButton. The way my circuit is set up, I've grouped buttons in groups of 3-5 in order to keep everything modular but still minimize pin usage. If I set this up for one set of buttons and declare one instance similarly to the example, it works perfect.
Now, if I create multiple instances of the class, eg:
And then in my loop(), update all four sets:
And setup if statements below for each one as shown in the example...
When pressing one of the buttons, it will perform the action assigned to all buttons with a matching voltage rating, regardless of pin. For example, if i have a circuit with 3 buttons on it attached only to A3 (with code setup to differing actions for A0,A1, and A2 but those pins not connected). And I push button (2) of 3, it will properly perform the button (2) action. However it will also perform the button (2) action for the A0, A1, A2 pins even though they are not being triggered.
Now, if I turn off all the other updates and only .update() one pin, it will work correctly and I can switch which pin I update and maintain proper function. So there is only disfunction if i .update() more than one pin (which is obviously required if I'm going to have more than one set of buttons). It's as if when another instance of the class is updated, the state variables within the class are getting shared/overwritten, causing downstream problems.