it behaves as expected with your test.
otherwise
here is the total code i use from you at the moment :
#include <Encoder.h> // Include the Encoder library.
#include <Control_Surface.h> // Include the Control Surface library
USBMIDI_Interface midi;
CD74HC4067 mux1 = {
6, // digital input pin
{2, 3, 4, 5} // Address pins S0, S1, S2, S3
};
CCButton buttonarray1[] = {
{ mux1.pin(0), { 36, CHANNEL_1 } },
{ mux1.pin(1), { 37, CHANNEL_1 } },
{ mux1.pin(2), { 38, CHANNEL_1 } },
{ mux1.pin(3), { 39, CHANNEL_1 } },
{ mux1.pin(4), { 40, CHANNEL_1 } },
{ mux1.pin(5), { 41, CHANNEL_1 } },
{ mux1.pin(6), { 42, CHANNEL_1 } },
{ mux1.pin(7), { 43, CHANNEL_1 } },
{ mux1.pin(8), { 44, CHANNEL_1 } },
{ mux1.pin(9), { 45, CHANNEL_1 } },
{ mux1.pin(10), { 46, CHANNEL_1 } },
{ mux1.pin(11), { 47, CHANNEL_1 } },
{ mux1.pin(12), { 48, CHANNEL_1 } },
{ mux1.pin(13), { 49, CHANNEL_1 } },
{ mux1.pin(14), { 50, CHANNEL_1 } },
{ mux1.pin(15), { 51, CHANNEL_1 } },
};
CD74HC4067 mux2 = {
7, // digital input pin
{2, 3, 4, 5} // Address pins S0, S1, S2, S3
};
CCButton buttonarray2[] = {
{ mux2.pin(0), { 52, CHANNEL_1 } },
{ mux2.pin(1), { 53, CHANNEL_1 } },
{ mux2.pin(2), { 54, CHANNEL_1 } },
{ mux2.pin(3), { 55, CHANNEL_1 } },
{ mux2.pin(4), { 56, CHANNEL_1 } },
{ mux2.pin(5), { 57, CHANNEL_1 } },
{ mux2.pin(6), { 58, CHANNEL_1 } },
{ mux2.pin(7), { 59, CHANNEL_1 } },
{ mux2.pin(8), { 60, CHANNEL_1 } },
{ mux2.pin(9), { 61, CHANNEL_1 } },
{ mux2.pin(10), { 62, CHANNEL_1 } },
{ mux2.pin(11), { 63, CHANNEL_1 } },
{ mux2.pin(12), { 64, CHANNEL_1 } },
{ mux2.pin(13), { 65, CHANNEL_1 } },
{ mux2.pin(14), { 66, CHANNEL_1 } },
{ mux2.pin(15), { 67, CHANNEL_1 } },
};
CD74HC4067 mux3 = {
8, // digital input pin
{2, 3, 4, 5} // Address pins S0, S1, S2, S3
};
CCButton buttonarray3[] = {
{ mux3.pin(0), { 68, CHANNEL_1 } },
{ mux3.pin(1), { 69, CHANNEL_1 } },
{ mux3.pin(2), { 70, CHANNEL_1 } },
{ mux3.pin(3), { 71, CHANNEL_1 } },
{ mux3.pin(4), { 72, CHANNEL_1 } },
{ mux3.pin(5), { 73, CHANNEL_1 } },
{ mux3.pin(6), { 74, CHANNEL_1 } },
{ mux3.pin(7), { 75, CHANNEL_1 } },
{ mux3.pin(8), { 76, CHANNEL_1 } },
{ mux3.pin(9), { 77, CHANNEL_1 } },
{ mux3.pin(10), { 78, CHANNEL_1 } },
{ mux3.pin(11), { 79, CHANNEL_1 } },
{ mux3.pin(12), { 80, CHANNEL_1 } },
{ mux3.pin(13), { 81, CHANNEL_1 } },
{ mux3.pin(14), { 82, CHANNEL_1 } },
{ mux3.pin(15), { 83, CHANNEL_1 } },
};
CD74HC4067 mux4 = {
9, // digital input pin
{2, 3, 4, 5} // Address pins S0, S1, S2, S3
};
CCButton buttonaray4[] = {
{ mux4.pin(0), { 84, CHANNEL_1 } },
{ mux4.pin(1), { 85, CHANNEL_1 } },
{ mux4.pin(2), { 86, CHANNEL_1 } },
{ mux4.pin(3), { 87, CHANNEL_1 } },
{ mux4.pin(4), { 88, CHANNEL_1 } },
{ mux4.pin(5), { 89, CHANNEL_1 } },
{ mux4.pin(6), { 90, CHANNEL_1 } },
{ mux4.pin(7), { 91, CHANNEL_1 } },
{ mux4.pin(8), { 92, CHANNEL_1 } },
{ mux4.pin(9), { 93, CHANNEL_1 } },
{ mux4.pin(10), { 94, CHANNEL_1 } },
{ mux4.pin(11), { 95, CHANNEL_1 } },
{ mux4.pin(12), { 96, CHANNEL_1 } },
{ mux4.pin(13), { 97, CHANNEL_1 } },
{ mux4.pin(14), { 98, CHANNEL_1 } },
{ mux4.pin(15), { 99, CHANNEL_1 } },
};
CCRotaryEncoder enc1 = {
{22, 23}, // pins
100, // MIDI address (CC number + optional channel)
1, // optional multiplier if the control isn't fast enough
};
CCRotaryEncoder enc2 = {
{24, 25}, // pins
101, // MIDI address (CC number + optional channel)
1, // optional multiplier if the control isn't fast enough
};
CCRotaryEncoder enc3 = {
{26, 27}, // pins
102, // MIDI address (CC number + optional channel)
1, // optional multiplier if the control isn't fast enough
};
CCRotaryEncoder enc4 = {
{28, 29}, // pins
103, // MIDI address (CC number + optional channel)
1, // optional multiplier if the control isn't fast enough
};
CCRotaryEncoder enc5 = {
{30, 31}, // pins
104, // MIDI address (CC number + optional channel)
1, // optional multiplier if the control isn't fast enough
};
CCRotaryEncoder enc6 = {
{32, 33}, // pins
105, // MIDI address (CC number + optional channel)
1, // optional multiplier if the control isn't fast enough
};
CCRotaryEncoder enc7 = {
{34, 35}, // pins
106, // MIDI address (CC number + optional channel)
1, // optional multiplier if the control isn't fast enough
};
CCRotaryEncoder enc8 = {
{36, 37}, // pins
107, // MIDI address (CC number + optional channel)
1, // optional multiplier if the control isn't fast enough
};
CCRotaryEncoder enc9 = {
{38, 39}, // pins
108, // MIDI address (CC number + optional channel)
1, // optional multiplier if the control isn't fast enough
};
CCRotaryEncoder enc10 = {
{40, 41}, // pins
109, // MIDI address (CC number + optional channel)
1, // optional multiplier if the control isn't fast enough
};
CCRotaryEncoder enc11 = {
{42, 43}, // pins
110, // MIDI address (CC number + optional channel)
1, // optional multiplier if the control isn't fast enough
};
CCRotaryEncoder enc12 = {
{44, 45}, // pins
111, // MIDI address (CC number + optional channel)
1, // optional multiplier if the control isn't fast enough
};
CCRotaryEncoder enc13 = {
{46, 47}, // pins
112, // MIDI address (CC number + optional channel)
1, // optional multiplier if the control isn't fast enough
};
CCRotaryEncoder enc14 = {
{48, 49}, // pins
113, // MIDI address (CC number + optional channel)
1, // optional multiplier if the control isn't fast enough
};
CCRotaryEncoder enc15 = {
{50, 51}, // pins
114, //
1, // optional multiplier if the control isn't fast enough
};
CCRotaryEncoder enc16 = {
{52, 53}, // pins
115, //
1, // optional multiplier if the control isn't fast enough
};
//--------------------------------------------------------------------------- extra 4
CCRotaryEncoder enc17 = {
{A8, A9}, // pins
116, // MIDI address (CC number + optional channel)
1, // optional multiplier if the control isn't fast enough
};
CCRotaryEncoder enc18 = {
{A10, A11}, // pins
117, // MIDI address (CC number + optional channel)
1, // optional multiplier if the control isn't fast enough
};
CCRotaryEncoder enc19 = {
{A12, A13}, // pins
118, // MIDI address (CC number + optional channel)
1, // optional multiplier if the control isn't fast enough
};
CCRotaryEncoder enc20 = {
{A14, A15}, // pins
119, // MIDI address (CC number + optional channel)
1, // optional multiplier if the control isn't fast enough
};
void setup() {
Serial.begin(9600);
RelativeCCSender::setMode(relativeCCmode::MACKIE_CONTROL_RELATIVE);
Control_Surface.begin();
}
void loop() {
Control_Surface.loop();
}
this code mess with the encoders rotation detection, jump over some ticks and very messy using. the button are working perfectly, from encoers themseves or other buttons.
if y remove the 5v pin from the encoder, they suddenly act properly but the 2 directions merge into one direction.
and if i use simple non midi, just staying in dfu alt mode with the simple encoder code, the encoder make perfect +4 or -4 per tick. even if i swap to midi mode removing pin connection, the falue red on the sequencer is ok.
so in the final deduction of mine there is a serious issue on the debounce section of the code with the hardware i have, an arduino mega and C11encoder, end they works just fine by themselves.
i tried the notes and volte code but the pultiplexer is not working, and there is no encoer on his code, i do not know how to code, but by observing, and modding, i go step by step and start to understand how it works, but i am into a wall of knowledge i cannot overpass at the moment.