-
Question about holding one button and pressing another for new functionality. I know you cannot detect 2 buttons being pressed on 1 pin at the same time but what if you use 2 analogue pins. I am using 2 analogue pins with 4 buttons on each. I am calling AnalogButtons twice for each group of buttons. Each button has its own normal single click function. Is there a way to detect 2 buttons being pressed (from different analogue pins) kind of like a shift + button on a keyboard? The buttons on one analogue pin act as the shift and the buttons on the other pin are like letters. When defining the click function for the button is there a way to detect if a button on another analogue pin is also being pressed? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
First of all, there's nothing preventing you to detect two buttons on the same pin: try this example circuit to see you can actually distinguish between the 4 possible combinations of 2 buttons, you just have to pick the right resistors so to leave enough room to account for any fluctuation. Obviously this gets exponentially more complicated as buttons get added, but I still believe this is the easiest route, just defining an additional virtual button matching the desired voltage, Sure, you can add any additional check in the button function, so what you are describing is totally possible: store the status of the Once again, this last circuit should be handled by the library as a set of 8 different buttons, 4 normal and 4 shifted. |
Beta Was this translation helpful? Give feedback.
First of all, there's nothing preventing you to detect two buttons on the same pin: try this example circuit to see you can actually distinguish between the 4 possible combinations of 2 buttons, you just have to pick the right resistors so to leave enough room to account for any fluctuation.
Obviously this gets exponentially more complicated as buttons get added, but I still believe this is the easiest route, just defining an additional virtual button matching the desired voltage,
Sure, you can add any additional check in the button function, so what you are describing is totally possible: store the status of the
shift
button in a global variable and change thenormal
buttons behaviour de…