// CD74HC4067
// 16-Channel Analog Multiplexer
// Demultiplexing not implemented for this simulation.
// https://www.ti.com/lit/ds/symlink/cd74hc4067.pdf
#include "Mux.h"
#define S0 18
#define S1 19
#define S2 22
#define S3 23
#define CLK 32
#define DT 35
#define SW 34
#define EN 33
uint8_t pins[4] {S0, S1, S2, S3};
uint8_t ens[2]{25, 26};
auto m = COMBINED_MUX(pins, ens);
int counter[16] {};
int btnCounter[16] {};
bool currentStateCLK[16] {};
bool lastStateCLK[16] {};
bool btnStates[16] {};
void setup() {
Serial.begin(115200);
pinMode(32, OUTPUT);
m.setup();
}
void loop() {
for (size_t i = 0; i < m.length(); i++) {
m.select(0);
digitalWrite(32, 1);
delay(1000);
m.select(16);
delay(1000);
digitalWrite(32, 0);
delay(1000);
}
}