Hi everybody,
i'm new to arduino and i try to build my own custom midi-controller for ableton live.
i've got a pus2-controller, but for effects and synths, i want to use custom-midi-controller.
Here is a picture:
I try to develope the code step by step, so i got the 4x4 button matrix working, if it's directly connected to 8 digital pins of my leonard.
Here the code:
Blockzitat
#include <Control_Surface.h>
USBMIDI_Interface midi;
// The note numbers corresponding to the buttons in the matrix
const AddressMatrix <4, 4> addresses {{
{36, 37, 38, 39},
{40, 41, 42, 43},
{44, 45, 46, 47},
{48, 49, 50, 51
},
}};
NoteButtonMatrix<4, 4> buttonmatrix {
{0, 1, 2, 3},
{4, 5, 6, 7}, // row pins
// column pins
addresses, // address matrix
CHANNEL_1, // channel and cable number
};
void setup() {
Control_Surface.begin();
}
void loop() {
Control_Surface.loop();
}
now i wanted to get the matrix running over 2 CD74HC4067, but it does nothing
#include <Control_Surface.h>
USBMIDI_Interface midi;
CD74HC4067 mux1 = { 7, {2, 3, 4, 5} };
CD74HC4067 mux2 = { 8, {2, 3, 4, 5} };
// The note numbers corresponding to the buttons in the matrix
const AddressMatrix <4, 4> addresses {{
{36, 37, 38, 39},
{40, 41, 42, 43},
{44, 45, 46, 47},
{48, 49, 50, 51
},
}};
NoteButtonMatrix<4, 4> buttonmatrix {
{mux1.pin(0), mux1.pin(1), mux1.pin(2), mux1.pin(3)}, // row pins
{mux2.pin(0), mux2.pin(1), mux2.pin(2), mux2.pin(3)}, // column pins
addresses, // address matrix
CHANNEL_1, // channel and cable number
};
void setup() {
Control_Surface.begin();
mux1.begin();
mux2.begin();
//for(int i=0; i<15; i++);
// {
// //do I need to assign inputs and outputs?
mux1.pinMode(0, INPUT_PULLUP);
mux2.pinMode(0, INPUT_PULLUP);
// }
};
void loop() {
Control_Surface.loop();
}
i also can't get any action out of the buttons, if use just one multiplexer:
#include <Control_Surface.h>
USBMIDI_Interface midi;
CD74HC4067 mux_1{12, {8, 9, 10, 11} , }; //input, S0-S3, optional enable
// The note numbers corresponding to the buttons in the matrix
const AddressMatrix <4, 4> addresses {{
{36, 37, 38, 39},
{40, 41, 42, 43},
{44, 45, 46, 47},
{48, 49, 50, 51
},
}};
NoteButtonMatrix<4, 4> buttonmatrix {
{mux_1.pin(0), mux_1.pin(1), mux_1.pin(2), mux_1.pin(3)}, // column pins
{2, 3, 4, 5}, // row pins
addresses, // address matrix
CHANNEL_1, // channel and cable number
};
void setup()
{
mux_1.begin();
for(int i=0; i<3; i++)
{
//do I need to assign inputs and outputs?
mux_1.pinMode(i, INPUT_PULLUP);
}
Control_Surface.begin(); // Initialize Control Surface
}
void loop() {
Control_Surface.loop();
}
could anybody help me?