here is the code ive been trying to work with its only for one 4051 but its a start
#include <Debounce.h>
int mux_buttonPin = 5;
Debounce debouncer = Debounce( 20 , mux_buttonPin );
int digital_state [7] = {
LOW};//set aside input values for mux
int r0 = 0; //value select pin at the 4051 (s0)
int r1 = 0; //value select pin at the 4051 (s1)
int r2 = 0; //value select pin at the 4051 (s2)
int row = 0; // storeing the bin code
int count = 0; // just a count
int bin [] = {
000, 1, 10, 11, 100, 101, 110, 111};//bin = binär, some times it is so easy
void setup(){
for (int i=0; i<=7; i++) {
pinMode(digital_state[i], INPUT); //mux inputs
}
pinMode(2, OUTPUT); // s0
pinMode(3, OUTPUT); // s1
pinMode(4, OUTPUT); // s2
pinMode(mux_buttonPin, INPUT); // mux read pin //digital
Serial.begin(9600);
}
void loop () {
for (count=0; count<=7; count++) {
row = bin[count];
r0 = row & 0x01;
r1 = (row>>1) & 0x01;
r2 = (row>>2) & 0x01;
digitalWrite(2, r0);
digitalWrite(3, r1);
digitalWrite(4, r2);
Serial.println(bin[count]); //print current bin
debouncer.update ( ); // Update the debouncer
digital_state[count] = digitalRead(debouncer.read); //set mux input val for each digitalstate value
Serial.println(digital_state[count]); // print digital_state for debug
}
delay (10); //delay 10 for read between values
}
im having a hard time implementing the button pressed and release