using ClickButton library for multiplexed buttons

would it be possible to use such a library for multiplexed buttons?

If i am having 8 buttons on a multiplexer it would be great if i could give more than one use to each button.
I have used before the ClickButton library to give buttons DoubleClick and Click+Hold functionalities, and i was quite happy with this.

i am now trying a project where i have 8 buttons on a 4051 multiplexer.
when i try to add the .click i always get a error:

request for member 'click' in 'buttonValue[buttonCount]', which is of non-class type 'int'

(.click added to 'buttonValue[buttonCount]')

The normal CLICK_SINGLECLICK works fine (i have no idea why!), but any other of the click options (double or triple clicks and all the holds) do not work at all.

Any ideas on how i could do this?

Here is the link to the ClickButton Library page: Google Code Archive - Long-term storage for Google Code Project Hosting.

Thank you!

Here is the link to the ClickButton Library

And the link to your code?

well, i thought there was a good change to get a straight "Not that is not possible" answer.
But i would be very happy to read otherwise...

earlier we talked about my code for the multiplexer and the shift register here:
http://forum.arduino.cc/index.php?topic=172733.0

here is what i think is the relevant code for this thread:

#include <ClickButton.h>
#include <Shifter.h>

const int buttonPin = A0;
int buttonValue[8] = {0,0,0,0,0,0,0,0};
int lastButtonValue[8] = {0,0,0,0,0,0,0,0};
int b0 = 0;
int b1 = 0;
int b2 = 0;

#define SER_Pin 7       // SER_IN
#define RCLK_Pin 6      // L_CLOCK
#define SRCLK_Pin 5     // CLOCK
#define NUM_REGISTERS 1 //how many shift registers are in the chain
long lastMillis = 0;
long interval = 250;
long previousMillis[8] = {0,0,0,0,0,0,0,0};
long currentMillis[8] = {0,0,0,0,0,0,0,0};
int ledBlinks[8] = {0,0,0,0,0,0,0,0};
int ledBlinksStates[8] = {0,0,0,0,0,0,0,0};

// Initialize Shifter using the Shifter library
Shifter shifter(SER_Pin, RCLK_Pin, SRCLK_Pin, NUM_REGISTERS);

int mode = 1;
void setup() {
  pinMode(10,OUTPUT); // S0
  pinMode(9, OUTPUT); // S1
  pinMode(8, OUTPUT); // S2
  
  Serial.begin(115200); 
} // end void setup

void loop() {
  for (int buttonCount = 0; buttonCount < 8; buttonCount++){
    b0 = bitRead(buttonCount,0);
    b1 = bitRead(buttonCount,1);
    b2 = bitRead(buttonCount,2);
    
    digitalWrite(10,b0);
    digitalWrite(9,b1);
    digitalWrite(8,b2);
    
    buttonValue[buttonCount] = digitalRead(buttonPin);
 
    if (buttonValue[buttonCount] == CLICK_SINGLECLICK && buttonValue[buttonCount] != lastButtonValue[buttonCount]) {
      Serial.println(buttonCount);
      if (ledBlinks[buttonCount] % 2 == 0) {
        ledBlinks[buttonCount] = 6; // blink 3 times
      } else if (ledBlinks[buttonCount] % 2 == 1) {
        ledBlinks[buttonCount] = 7; //blink 3 times if pressed on HIGH state
      }
    } // end SINGLECLICK

    // ...

...then the code continues with the blinking part, which i think is not important for my question about the ClickButton Library.

I think we have to "initialize" each button in void setup with:

ClickButton buttonObject(pin [,active [,CLICKBTN_PULLUP]]);

but how can i do that?
Isn't my multiplexer just READING values? Can i also WRITE values with it?

and then how can i add the .click to each of the buttons?

request for member 'click' in 'buttonValue[buttonCount]', which is of non-class type 'int'

So, buttonValue is an array of ints. The nth element in that array is an int. The int type does nto have a click() method.

You could have an array of ClickButton objects, and ask each object in the array for it's value.

PaulS:
So, buttonValue is an array of ints. The nth element in that array is an int. The int type does nto have a click() method.

You could have an array of ClickButton objects, and ask each object in the array for it's value.

Hmmm, sorry, but you lost me... =(

Well, i tried this:

for (int startButs = 0; startButs < 8; startButs++){
    b0 = bitRead(startButs,0);
    b1 = bitRead(startButs,1);
    b2 = bitRead(startButs,2);
    
    digitalWrite(10,b0);
    digitalWrite(9,b1);
    digitalWrite(8,b2);
    
  ClickButton buttons[startButs](buttonPin, LOW, CLICK_PULLUP);
  }

but i get the compiling error:

button_and_leds_TEST:80: error: variable-sized object 'buttons' may not be initialized

Also one other question:
this library initializes each button by setting them to low and enabling each button's pullup resistor on the Arduino board. right?
If so, hmmm, is there an internal pullup resistor on my analogue port connected to the Multiplexer that will work for all of them?

Any other ideas on how to have a SINGLE CLICK and a DOUBLE CLICK mode on each multiplexed button?

Well, i tried this:

Well, that is completely wrong. You are NOT declaring a ClickButton instance in that loop. You are trying to declare an array of ClickButton instances, of varying size (it changes every pass through loop), in the for loop.

Create a GLOBAL array of ClickButton instances.

Looking at how the instance needs to be defined, though, it really does not look like that is the solution. You have actually one pin that you want one instance of the ClickButton associated with.

Each time the shift register is programmed to connect one of it's 8 inputs to it's output, which is connected to one of the Arduino's inputs, you want to call it's methods.

Getting double click events is not going to happen, though.

PaulS:

Well, i tried this:

Getting double click events is not going to happen, though.

is there no way to do it? or i am just looking in a wrong direction?