Closed MistrKernnunos closed 2 years ago
Most of these problems turn out to be a wiring problem of the address lines of the mux. Are you 100% sure that you selected the correct pins, and that they are connected to the correct address pins?
I checked the wiring (it is on PCB) there si no conection between the buttons. And this happens with two independet pairs connected to two separate mux, but on the third it doesnt happen.
I'm not sure why that happens.
Could you write a minimal sketch with minimal hardware that still has the same problem?
Did you manage to solve it?
Unfortunatly no, i tried to swap the MUX, but it didnt solve the problem. And I found out that sometimes there is that problem and sometimes not, but there is no rule to that. To replicate the problem: I am using Teensy 3.2 buttons are connected to arduino through CD74HC4051E in array of 3 MUXes like this. Connected to VUSB for 5V and to 19, 20, 21. The bad ones arent connected to the same pins on the MUX. the bad ones are MIDI CCs 35 and 41 and the otreh pair is 32 and 32
Could you try the following test?
#include <MIDI_Controller.h> // Include the library
constexpr pin_t addr_1 = 19;
constexpr pin_t addr_2 = 20;
constexpr pin_t addr_3 = 21;
// Create an instance of 'AnalogMultiplex' with the output pin of the multiplexer connected to
// analog input pin A0 and the address pins connected to pins 19, 20, 21
AnalogMultiplex multiplexer(A0, { addr_1, addr_2, addr_3 } );
void setup() {
multiplexer.begin();
Serial.begin(115200);
while(!Serial);
}
void loop() {
for (uint8_t i = 0; i < 8; i++) {
multiplexer.analogRead(i);
Serial.print(i);
Serial.print(": ");
Serial.print(digitalRead(addr_3));
Serial.print(digitalRead(addr_2));
Serial.print(digitalRead(addr_1));
Serial.println();
delay(500);
}
delay(10000);
}
Then open the Serial monitor (CTRL+SHIFT+M
) and inspect the result. It should look exactly like this:
0: 000
1: 001
2: 010
3: 011
4: 100
5: 101
6: 110
7: 111
If you get a different result, there is a bug in the library. However, I've checked it again, and tested the above on my Teensy 3.2, and it works as expected, so I think that's rather unlikely (but not impossible, of course).
If you get the same result, but the multiplexers still don't work, you should look at the hardware again. Your results seem to suggest that something is wrong with address line 3 (pin 21).
The fact that this only happens sometimes leads me to believe that it's a hardware issue as well.
You could measure the voltages on the mux address lines (or connect LEDs to them) during the test program, and they should match the binary prints in the Serial monitor.
sorry for the late responsion.
there was problem in wiring I have switched some pins
now it is repaired, but it is doing the same thing.
What were the results of the test I proposed?
It turned out right
Hi, i have a problem. I am using buttons conected to teensy 3,2 through mux (74hc4051). the core of it is that, i have two buttons, that when i press onei recive midi signals like i pushed both.
Arduino board: ? Arduino UNO, Arduino Leonardo, Arduino DUE, Arduino MEGA, Arduino Micro, Teensy 3.2, ... ?
Schematic: ?
Software versions:
MIDI Controller library: ? 3.1.0 ?
Arduino IDE: 1.8.5?
Operating System: ? Windows Operating System version: ? 10 (Teensyduino**): ? 1.42 ?
Settings in the IDE
midi+usb, max clock speed, but not overc
Full code
Steps taken to try to diagnose or solve the problem
photo of midi monitor