Is Serial USB Speed Abstracted Away? #926
-
I have the Increment/Decrement example working with 127 program changer array, works great. I can see everything on my Mac via MIDIView with a USB cable connection. I'm going to use Rx/Tx pins on an Arduino Micros plus a HobbyTronics USB host board to send the MIDI messages to a MIDI capable guitar pedal, Source Audio C4. I don't see anywhere to set a connection rate, like Serial.begin(9600). Is that not necessary because it's handled in the library? Right now my code is simple (thanks to your library!) see below. THANKS! #include <Control_Surface.h> // Include the Control Surface library
// Instantiate a MIDI over USB interface
USBMIDI_Interface midi;
// Instantiate a program changer with 3 programs
ProgramChanger<127> programChanger {
{
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,
21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,
41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,
61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,
81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,
101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,
121,122,123,124,125,126,
},
CHANNEL_1, // MIDI channel to use
};
// Instantiate a selector to control which one of the three programs is active
IncrementDecrementSelector<127> selector = {
programChanger, // what to select
{5, 6}, // push button pins (increment, decrement)
Wrap::Wrap, // wrap around if min/max program is reached
};
// The library comes with many different Selectors, like rotary encoders,
// push buttons that increment or decrement the setting, versions with LEDs
// to display the current setting, etc.
// https://tttapa.github.io/Control-Surface-doc/Doxygen/d0/d0c/group__Selectors.html
void setup() {
Control_Surface.begin(); // Initialize Control Surface
}
void loop() {
Control_Surface.loop(); // Update the Control Surface
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
MIDI over USB doesn't have a baud rate. |
Beta Was this translation helpful? Give feedback.
MIDI over USB doesn't have a baud rate.
To use MIDI over Serial, you can use
SerialMIDI_Interface
orHardwareSerialMIDI_Interface
, which accept the baud rate as a second, optional parameter.