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?