I have a problem that drives me crazy, same wiring and code working 100% on Arduino Mega but on Teensy 3.6 one button affects the other once.

I used a 10 K resistor between GND and data pins and 3.3v goes to the other leg of the button, please see the diagram below.

Click image for larger version. 

Name:	Screen Shot 2019-08-15 at 19.26.34.jpg 
Views:	2 
Size:	140.1 KB 
ID:	17239

Even when I try to use Internal PULLUP / PULLDOWN resistors it still shows the wrong values for the button pressed.

For Example Pushing Button #0 Gives me the following result:

Click image for larger version. 

Name:	Pushing Button Number 0.jpg 
Views:	1 
Size:	112.6 KB 
ID:	17240

Pushing Button #4 Gives me the following result:

Click image for larger version. 

Name:	Pushing Button Number 4.png 
Views:	1 
Size:	70.9 KB 
ID:	17241

Again, same schematics and code works fine on Arduino Mega 2560 (the only difference I can think of it's 5v if that relevant)

Your help is much appreciated !

Hardware: Teensy 3.6 (3.3volt)
Software: Arduino IDE v1.8.9
Error Messages: See Above Screenshot of Serial Monitor
Wiring: See Above


* This example demonstrates how to read digital signals
* It assumes there are push buttons with pullup resistors
* connected to the 16 channels of the 74HC4067 mux/demux (in my case 8 buttons)
* For more about the interface of the library go to
* https://github.com/pAIgn10/MUX74HC4067

const int ledPin = 13;

#include "MUX74HC4067.h"

// Creates a MUX74HC4067 instance
// 1st argument is the Arduino PIN to which the EN pin connects
// 2nd-5th arguments are the Arduino PINs to which the S0-S3 pins connect
MUX74HC4067 mux(5, 0, 1, 2, 3);

void setup()
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, HIGH); // set the LED on
Serial.begin(9600); // Initializes serial port

// Configures how the SIG pin will be interfaced
// e.g. The SIG pin connects to PIN 3 on the Arduino,
// and PIN 3 is a digital input
mux.signalPin(4, INPUT_PULLUP, DIGITAL);

// Reads the 16 channels and reports on the serial monitor
// if the corresponding push button is pressed
void loop()
byte data;

for (byte i = 0; i < 8; ++i)
// Reads from channel i and returns HIGH or LOW
data = mux.read(i);

Serial.print("Push button at channel ");
Serial.print(" is ");
if ( data == LOW ) Serial.println("not pressed");
else if ( data == HIGH) Serial.println("pressed");