USBMIDI interface question #782
Unanswered
interstaller555
asked this question in
Q&A
Replies: 2 comments
-
Hola, tu problema esta en que a partir de CHANNEL_17 en adelante no existe, solo puedes usar de CHANNEL_1 a CHANNEL_16, lo que tienes que cambiar es la definicion que sigue despues MIDI_CC::, puedes usar las palabras que proporciona la libreria que ahora no recuerdo en que documento estan, o mejor usa numeros maximo asta 127, lo demas del codigo esta bien |
Beta Was this translation helpful? Give feedback.
0 replies
-
Eso es lo que me hace falta - ósea - me parece que los canales solo suben hasta 16. Tengo que mirar otra vez la verdad quede esperando partes para un controlador y no lo he tocado. Gracias!
…Sent from my iPhone
On Aug 17, 2022, at 11:15 PM, Veroledez ***@***.***> wrote:
Hola, tu problema esta en que a partir de CHANNEL_17 en adelante no existe, solo puedes usar de CHANNEL_1 a CHANNEL_16, lo que tienes que cambiar es la definicion que sigue despues MIDI_CC::, puedes usar las palabras que proporciona la libreria que ahora no recuerdo en que documento estan, o mejor usa numeros maximo asta 127, lo demas del codigo esta bien
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
hello! I'm trying to build a controller with 30 pots (10k). my goal is to build a controller that sends midi over usb to a raspberry pi for something like minidexed or a synth in PD without needing a sniffer or convertor.
I'm using two cd74hc4067 multiplexers. When I modify the code examples I'm not sure I'm getting access to all the pots - partially based on the IDE turning from blue - to black on the text.. I know, that doesn't really help. I've got everything wired together I'm just not sure I have to code right... I'm a complete noob... thank you for all your help!
attached is my current code.
`#include <Control_Surface.h> // We declare that we will use the Control Surface ready-made code library
#include <MIDI_Interfaces/USBMIDI_Interface.hpp>
USBMIDI_Interface midi; // We declare the type of MIDI communication of the Arduino with the PC
CD74HC4067 mux1 = { // We define the first Multiplexer as mux1
A0, // We map the SIG PIN of the first Multiplexer to the analog input on Arduino PIN A0
{2, 3, 4, 5} // Map the PINs S0 , S1 , S2 , S3 of the first Multiplexer to the digital inputs on the Arduino's PINs 2 , 3 , 4 , 5
};
CD74HC4067 mux2 = { // Same process as above for the second Multiplexer (mux2)
A1,
{6, 7, 8, 9}
};
// The filtered value read when potentiometer is at the 0% position
constexpr analog_t minimumValue = 255;
// The filtered value read when potentiometer is at the 100% position
constexpr analog_t maximumValue = 16383 - 255;
// A mapping function to eliminate the dead zones of the potentiometer:
// Some potentiometers don't output a perfect zero signal when you move them to
// the zero position, they will still output a value of 1 or 2, and the same
// goes for the maximum position.
analog_t mappingFunction(analog_t raw) {
// make sure that the analog value is between the minimum and maximum
raw = constrain(raw, minimumValue, maximumValue);
// map the value from [minimumValue, maximumValue] to [0, 16383]
return map(raw, minimumValue, maximumValue, 0, 16383);
// Note: 16383 = 2¹⁴ - 1 (the maximum value that can be represented by
// a 14-bit unsigned number
}
CCPotentiometer muxPots[] = {
{ mux1.pin(0), { MIDI_CC::Channel_Volume, CHANNEL_1 } },
{ mux1.pin(1), { MIDI_CC::Channel_Volume, CHANNEL_2 } },
{ mux1.pin(2), { MIDI_CC::Channel_Volume, CHANNEL_3 } },
{ mux1.pin(3), { MIDI_CC::Channel_Volume, CHANNEL_4 } },
{ mux1.pin(4), { MIDI_CC::Channel_Volume, CHANNEL_5 } },
{ mux1.pin(5), { MIDI_CC::Channel_Volume, CHANNEL_6 } },
{ mux1.pin(6), { MIDI_CC::Channel_Volume, CHANNEL_7 } },
{ mux1.pin(7), { MIDI_CC::Channel_Volume, CHANNEL_8 } },
{ mux1.pin(8), { MIDI_CC::Channel_Volume, CHANNEL_9 } },
{ mux1.pin(9), { MIDI_CC::Channel_Volume, CHANNEL_10 } },
{ mux1.pin(10), { MIDI_CC::Channel_Volume, CHANNEL_11 } },
{ mux1.pin(11), { MIDI_CC::Channel_Volume, CHANNEL_12 } },
{ mux1.pin(13), { MIDI_CC::Channel_Volume, CHANNEL_13 } },
{ mux1.pin(14), { MIDI_CC::Channel_Volume, CHANNEL_14 } },
{ mux1.pin(15), { MIDI_CC::Channel_Volume, CHANNEL_15 } },
{ mux1.pin(16), { MIDI_CC::Channel_Volume, CHANNEL_16 } },
{ mux2.pin(0), { MIDI_CC::Channel_Volume, CHANNEL_17 } },
{ mux2.pin(1), { MIDI_CC::Channel_Volume, CHANNEL_18 } },
{ mux2.pin(2), { MIDI_CC::Channel_Volume, CHANNEL_19 } },
{ mux2.pin(3), { MIDI_CC::Channel_Volume, CHANNEL_20 } },
{ mux2.pin(4), { MIDI_CC::Channel_Volume, CHANNEL_21 } },
{ mux2.pin(5), { MIDI_CC::Channel_Volume, CHANNEL_22 } },
{ mux2.pin(6), { MIDI_CC::Channel_Volume, CHANNEL_23 } },
{ mux2.pin(7), { MIDI_CC::Channel_Volume, CHANNEL_24 } },
{ mux2.pin(8), { MIDI_CC::Channel_Volume, CHANNEL_25 } },
{ mux2.pin(9), { MIDI_CC::Channel_Volume, CHANNEL_26 } },
{ mux2.pin(10), { MIDI_CC::Channel_Volume, CHANNEL_27 } },
{ mux2.pin(11), { MIDI_CC::Channel_Volume, CHANNEL_28 } },
{ mux2.pin(13), { MIDI_CC::Channel_Volume, CHANNEL_29 } },
{ mux2.pin(14), { MIDI_CC::Channel_Volume, CHANNEL_30 } },
{ mux2.pin(15), { MIDI_CC::Channel_Volume, CHANNEL_31 } },
{ mux2.pin(16), { MIDI_CC::Channel_Volume, CHANNEL_32 } },
};
void setup() {
Control_Surface.begin(); //We declare that when the Arduino is activated we want the Control Surface function to start
}
void loop() {
Control_Surface.loop(); // We declare that we want it to continuously run the Control Surface function to update the values of the potentiometers and send the new ones when we move a potentiometer
}`
Beta Was this translation helpful? Give feedback.
All reactions