Greetings I have a question friends, I try to use the MIDI_Controller library to use the digital multiplexer to connect 16 potentiometers in a 16-output analog multiplexer, I see that the library codes only have 1 analog and 3 digital pins for communication, in my In case my multiplexer has 4 digital for communication with the 16 channels, my question is, could the multriplexer work with the library codes simply by increasing that pin to the library code?
// 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 2, 3 and 4.
AnalogMultiplex multiplexer(A0, { 2, 3, 4 } );
// Create 8 new instances of the class 'Analog', on the 8 pins of the multiplexer,
// that send MIDI messages with controller 7 (channel volume) on channels 1 - 8
Analog potentiometers[] = {
{multiplexer.pin(0), MIDI_CC::Channel_Volume, 1},
{multiplexer.pin(1), MIDI_CC::Channel_Volume, 2},
{multiplexer.pin(2), MIDI_CC::Channel_Volume, 3},
{multiplexer.pin(3), MIDI_CC::Channel_Volume, 4},
{multiplexer.pin(4), MIDI_CC::Channel_Volume, 5},
{multiplexer.pin(5), MIDI_CC::Channel_Volume, 6},
{multiplexer.pin(6), MIDI_CC::Channel_Volume, 7},
{multiplexer.pin(7), MIDI_CC::Channel_Volume, 8}
};
void setup() {}
void loop() {
// Refresh the MIDI controller (check whether the potentiometer's input has changed since last time, if so, send the new value over MIDI)
MIDI_Controller.refresh();
}
------------------------------------------16 analog CODE---------------------------------------------
include // Include the library
// 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 2, 3 and 4.
AnalogMultiplex multiplexer(A0, { 2, 3, 4, 5 } );
// Create 8 new instances of the class 'Analog', on the 8 pins of the multiplexer,
// that send MIDI messages with controller 7 (channel volume) on channels 1 - 8
Analog potentiometers[] = {
{multiplexer.pin(0), MIDI_CC::Channel_Volume, 1},
{multiplexer.pin(1), MIDI_CC::Channel_Volume, 2},
{multiplexer.pin(2), MIDI_CC::Channel_Volume, 3},
{multiplexer.pin(3), MIDI_CC::Channel_Volume, 4},
{multiplexer.pin(4), MIDI_CC::Channel_Volume, 5},
{multiplexer.pin(5), MIDI_CC::Channel_Volume, 6},
{multiplexer.pin(6), MIDI_CC::Channel_Volume, 7},
{multiplexer.pin(7), MIDI_CC::Channel_Volume, 8}
{multiplexer.pin(8), MIDI_CC::Channel_Volume, 9},
{multiplexer.pin(9), MIDI_CC::Channel_Volume, 10 },
{multiplexer.pin(10), MIDI_CC::Channel_Volume, 11},
{multiplexer.pin(11), MIDI_CC::Channel_Volume, 12},
{multiplexer.pin(12), MIDI_CC::Channel_Volume, 13},
{multiplexer.pin(13), MIDI_CC::Channel_Volume, 14},
{multiplexer.pin(14), MIDI_CC::Channel_Volume, 15},
{multiplexer.pin(15), MIDI_CC::Channel_Volume, 16}
};
void setup() {}
void loop() {
// Refresh the MIDI controller (check whether the potentiometer's input has changed since last time, if so, send the new value over MIDI)
MIDI_Controller.refresh();
}
Greetings I have a question friends, I try to use the MIDI_Controller library to use the digital multiplexer to connect 16 potentiometers in a 16-output analog multiplexer, I see that the library codes only have 1 analog and 3 digital pins for communication, in my In case my multiplexer has 4 digital for communication with the 16 channels, my question is, could the multriplexer work with the library codes simply by increasing that pin to the library code?
----------------------------------------------ORIGINAL CODE-----------------------------------------
include // Include the library
// 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 2, 3 and 4. AnalogMultiplex multiplexer(A0, { 2, 3, 4 } );
// Create 8 new instances of the class 'Analog', on the 8 pins of the multiplexer, // that send MIDI messages with controller 7 (channel volume) on channels 1 - 8 Analog potentiometers[] = { {multiplexer.pin(0), MIDI_CC::Channel_Volume, 1}, {multiplexer.pin(1), MIDI_CC::Channel_Volume, 2}, {multiplexer.pin(2), MIDI_CC::Channel_Volume, 3}, {multiplexer.pin(3), MIDI_CC::Channel_Volume, 4}, {multiplexer.pin(4), MIDI_CC::Channel_Volume, 5}, {multiplexer.pin(5), MIDI_CC::Channel_Volume, 6}, {multiplexer.pin(6), MIDI_CC::Channel_Volume, 7}, {multiplexer.pin(7), MIDI_CC::Channel_Volume, 8} };
void setup() {}
void loop() { // Refresh the MIDI controller (check whether the potentiometer's input has changed since last time, if so, send the new value over MIDI) MIDI_Controller.refresh(); }
------------------------------------------16 analog CODE---------------------------------------------
include // Include the library
// 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 2, 3 and 4. AnalogMultiplex multiplexer(A0, { 2, 3, 4, 5 } );
// Create 8 new instances of the class 'Analog', on the 8 pins of the multiplexer, // that send MIDI messages with controller 7 (channel volume) on channels 1 - 8 Analog potentiometers[] = { {multiplexer.pin(0), MIDI_CC::Channel_Volume, 1}, {multiplexer.pin(1), MIDI_CC::Channel_Volume, 2}, {multiplexer.pin(2), MIDI_CC::Channel_Volume, 3}, {multiplexer.pin(3), MIDI_CC::Channel_Volume, 4}, {multiplexer.pin(4), MIDI_CC::Channel_Volume, 5}, {multiplexer.pin(5), MIDI_CC::Channel_Volume, 6}, {multiplexer.pin(6), MIDI_CC::Channel_Volume, 7}, {multiplexer.pin(7), MIDI_CC::Channel_Volume, 8} {multiplexer.pin(8), MIDI_CC::Channel_Volume, 9}, {multiplexer.pin(9), MIDI_CC::Channel_Volume, 10 }, {multiplexer.pin(10), MIDI_CC::Channel_Volume, 11}, {multiplexer.pin(11), MIDI_CC::Channel_Volume, 12}, {multiplexer.pin(12), MIDI_CC::Channel_Volume, 13}, {multiplexer.pin(13), MIDI_CC::Channel_Volume, 14}, {multiplexer.pin(14), MIDI_CC::Channel_Volume, 15}, {multiplexer.pin(15), MIDI_CC::Channel_Volume, 16} };
void setup() {}
void loop() { // Refresh the MIDI controller (check whether the potentiometer's input has changed since last time, if so, send the new value over MIDI) MIDI_Controller.refresh(); }