First time working with multiplexers. The goal is to read input from 16 buttons, but I'm struggling to figure out the wiring with a minimal single button setup. Don't think it's an issue of poor connections as I did have it half-working at one point -- the mux would read high after pressing and holding the button, but this was in a wiring configuration that didn't make much sense to me. The wiring in the attached image is how I have it now, and is closer to how it seems like it should be, but I'm very likely mistaken as button presses don't cause any change in the reads. Any ideas?
I'm using a Teensy 4.1 powered by external 5V (not USB), SparkFun CD74HC4067 mux breakout, and the MUX74HC4067 library.
I'm using a Teensy 4.1 powered by external 5V (not USB), SparkFun CD74HC4067 mux breakout, and the MUX74HC4067 library.
Code:
#include "MUX74HC4067.h"
#define EN_PIN 21
#define S0_PIN 20
#define S1_PIN 19
#define S2_PIN 18
#define S3_PIN 17
#define SIG_PIN 16
MUX74HC4067 mux(EN_PIN, S0_PIN, S1_PIN, S2_PIN, S3_PIN);
void setup(void)
{
...
mux.signalPin(SIG_PIN, INPUT, DIGITAL);
}
void loop(void)
{
byte data;
data = mux.read(0);
Serial.println(data);
}