Using CD74HC4067 one inputs turns 2 channels on?


New member
I have a 8 home switchs, Teensy 4.1 and a CD74HC4067 Multiplexer.

I've connected my Teensy to my Mac using USB to be able to read the Serial prints.

I've connected a 5v PSU to a DC Step Down, taking the voltage down to 3.3v and then feeding it to all switches and multiplexer.
With that setup switching on one switch caused all inputs to go HIGH on the multiplexer SIG pin.
I understood I have "Floating Inputs" so when the switch is "open" there's no GND or V+ flowing in the cable so it is sensitive to noise from nearby Voltages.

So I've decided to connect all my switches to GND directly from the Step Down Converter and then use Arduino Internal Pullup Resistor.

Now the readings are way more stable but for some reason closing one switch, affects 2 channels on the multiplexer instead of one.
const int selectPins[] {2, 3, 4 ,5};
const int commonPin = 10;
void setup() {
  // put your setup code here, to run once:
  for (int i = 0; i < 4; i++) {
    pinMode(selectPins[i], OUTPUT);
  pinMode(commonPin, INPUT_PULLUP);
void loop() {
  // put your main code here, to run repeatedly:
  for (int channel = 0; channel < 16; channel++) {
    int switchState = digitalRead(commonPin);
    Serial.print("Switch ");
    Serial.print(": ");
    Serial.println(switchState ? "ON" : "OFF");
void selectChannel(int channel) {
  digitalWrite(selectPins[0], (channel & 0x01) > 0);
  digitalWrite(selectPins[1], (channel & 0x02) > 0);
  digitalWrite(selectPins[2], (channel & 0x04) > 0);
  digitalWrite(selectPins[3], (channel & 0x08) > 0);

What am I doing wrong?