Hello! Beginner in programming and electronics, I made a midi controller with an arduino pro micro, 64 pots 10k connected to 4 multiplexers 16 channels and 2 pots 10k directly to 2 analog pins.
I used the example code supplied with the library and everything worked fine, but I noticed a bit of latency when I turned the pots, which isn't very optimal for live use. I've read that this is due to the sampling time required for a single analog input and how much memory all those Control Surface elements will require.
I therefore deleted the SYSEX data as advised in the Control SURFACE FAQ to save memory, hoping that this would solve my problem, in vain.
I wonder if switching from a pro micro to a teensy would solve my problem? Or if solving this problem is far beyond the skills of a beginner?
Thanks for reading!
Here's my code:
#include <Control_Surface.h> // Inclure la bibliothèque
USBMIDI_Interface midi; // Instancier une interface MIDI à utiliser
CD74HC4067 mux1 {
A0, // Broche d'entrée analogique
{7, 4, 6, 5} // Broches d'adresse S0, S1, S2, S3
};
CD74HC4067 mux2 {
A1, // Broche d'entrée analogique
{7, 4, 6, 5} // Broches d'adresse S0, S1, S2, S3
};
CD74HC4067 mux3 {
A2, // Broche d'entrée analogique
{7, 4, 6, 5} // Broches d'adresse S0, S1, S2, S3
};
CD74HC4067 mux4 {
A3, // Broche d'entrée analogique
{7, 4, 6, 5} // Broches d'adresse S0, S1, S2, S3
};
CCPotentiometer pot1 { A8, 65};
CCPotentiometer pot2 { A9, 66};
;
// Créer un tableau d'objets CCPotentiometer avec des adresses MIDI numérotées de 1 à 66
CCPotentiometer volumePotentiometers[] {
{ mux1.pin(0), { 1} },
{ mux1.pin(1), { 2} },
{ mux1.pin(2), { 3} },
{ mux1.pin(3), { 4} },
{ mux1.pin(4), { 5} },
{ mux1.pin(5), { 6} },
{ mux1.pin(6), { 7} },
{ mux1.pin(7), { 8} },
{ mux1.pin(8), { 9} },
{ mux1.pin(9), { 10} },
{ mux1.pin(10), { 11} },
{ mux1.pin(11), { 12} },
{ mux1.pin(12), { 13} },
{ mux1.pin(13), { 14} },
{ mux1.pin(14), { 15} },
{ mux1.pin(15), { 16} },
{ mux2.pin(0), { 17} },
{ mux2.pin(1), { 18} },
{ mux2.pin(2), { 19} },
{ mux2.pin(3), { 20} },
{ mux2.pin(4), { 21} },
{ mux2.pin(5), { 22} },
{ mux2.pin(6), { 23} },
{ mux2.pin(7), { 24} },
{ mux2.pin(8), { 25} },
{ mux2.pin(9), { 26} },
{ mux2.pin(10), { 27} },
{ mux2.pin(11), { 28} },
{ mux2.pin(12), { 29} },
{ mux2.pin(13), { 30} },
{ mux2.pin(14), { 31} },
{ mux2.pin(15), { 32} },
{ mux3.pin(0), { 33} },
{ mux3.pin(1), { 34} },
{ mux3.pin(2), { 35} },
{ mux3.pin(3), { 36} },
{ mux3.pin(4), { 37} },
{ mux3.pin(5), { 38} },
{ mux3.pin(6), { 39} },
{ mux3.pin(7), { 40} },
{ mux3.pin(8), { 41} },
{ mux3.pin(9), { 42} },
{ mux3.pin(10), { 43} },
{ mux3.pin(11), { 44} },
{ mux3.pin(12), { 45} },
{ mux3.pin(13), { 46} },
{ mux3.pin(14), { 47} },
{ mux3.pin(15), { 48} },
{ mux4.pin(0), { 49} },
{ mux4.pin(1), { 50} },
{ mux4.pin(2), { 51} },
{ mux4.pin(3), { 52} },
{ mux4.pin(4), { 53} },
{ mux4.pin(5), { 54} },
{ mux4.pin(6), { 55} },
{ mux4.pin(7), { 56} },
{ mux4.pin(8), { 57} },
{ mux4.pin(9), { 58} },
{ mux4.pin(10), { 59} },
{ mux4.pin(11), { 60} },
{ mux4.pin(12), { 61} },
{ mux4.pin(13), { 62} },
{ mux4.pin(14), { 63} },
{ mux4.pin(15), { 64} },
};
void setup() {
Control_Surface.begin(); // Initialiser Control Surface
}
void loop() {
Control_Surface.loop(); // Mettre à jour Control Surface
}