While I wait for the HobbyTronics board I put together a diagram to follow for hook up. When you get a sec can you take a look?
I was informed that USB MIDI does not need a baud rate, so also no Serial.() object in the code. (I'm using a great library for the MIDI code, https://github.com/tttapa/Control-Surface.)
The C4 pedal also has settings to skip the power check on the incoming MIDI signal, so maybe 3.3V will be good, we'll see.
I also found out from the Teensy programmer who worked with the C4 that it's an HID USB device. I don't think that's going to affect my work at this point, but something to note.
USB MIDI itself does not have a configurable baud rate, but the HobbyTronics board you mention does communicate with the Arduino over a UART, at a rate of 31250 baud (which is the default for MIDI).
You would use it in your code as
Thanks, I've seen that example but I will dig into it deeper now. I was under the impression that if my board was sending MIDI messages to my computer that I could just connect it into the HobbyTronics board, connect that board to my pedal via USB cable and it would send them there. Sounded too easy, even for my dreams.
so if my pseudocode is like this:
void setup() {
Control_Surface.begin(); // Initialize Control Surface
}
void loop() {
Control_Surface.loop(); // Update the Control Surface
}
I assume I can add the MIDI init and listening code would be this:
USBMIDI_Interface midi;
void setup() {
Control_Surface.begin(); // Initialize Control Surface
midi.begin();
}
void loop() {
Control_Surface.loop(); // Update the Control Surface
midi.update();
}
Thanks again. This would be so much more difficult without the help of the knowledgable!
No, this won't work. The code you have right now (with the USBMIDI_Interface) sends MIDI messages over the Arduino's USB port.
In order to communicate with the HobbyTronics board, you need to send MIDI over the UART (the TX and RX pins of the Arduino), not the USB port.
Sending MIDI data over a UART is done by using the HardwareSerialMIDI_Interface rather than the USBMIDI_Interface.
You don't need those lines, Control_Surface.begin()/loop() will take care of that for you.
Hmm, looks like you told me just what to do and I ignored it! So this is all looking great to me, my code is basically correct, just need to instantiate an object that sends MIDI messages to Rx/Tx via 'Serial1'.
// Instantiate a MIDI over USB interface
//USBMIDI_Interface midi; - not for Rx/Tx
HardwareSerialMIDI_Interface midi {Serial1};
Once I get this rolling my next challenge is getting data back from the pedal. That is pretty far down the road but everything in the pedal and can be retrieved over USB. It's returned as one block of 'text' so your libraries accessing the content of a message will also be invaluable.
This Teensy code seems to get the data without callbacks but that's Teensy.
Thanks again to you all for the knowledge share. (Is that term too corporate?!)
Hi. Had an interesting forum chat with the person who wrote the C4 pedal library for Teensy. (1) He said I shouldn't be posting questions about Arduino in a Teensy forum (fair point) because it was for ppl who bought Teensy boards and (2) he said I should 'dump' (his words) my two boards and buy a Teensy. Ah, that's not how I roll, maybe Teensy next time. The 2 boards and the Control library are doing probably 80% of what I need. When I used to program getting 80% of the features complete was a big win.
His Teensy/C4 library can get the installed preset names list right off the pedal using a USB endpoint and the pedal's HID aspects. Maybe Control Surface could do that, maybe not, but I was never expecting to be able to do that anyway. I'm fine with having an array of the pedal's 128 preset names and stepping through it as the IncrementDecrementSelector<N> sends the program change commands. If I have to update the code once in a while to get new presets in the list that's fine. I could even add an SD card and put the list on it. I just have to match up the increments and decrements buttons with the names array and send the preset names to my TFT LCD. Then get back to playing music!
In my opinion the Teensy is a fine board and we sometimes get Teensy questions here, and for the right application I am happy to recommend using one. The graphic DSP capabilities have had a lot of work put into them and simplify a lot of digital signal processing applications (DSP). Also the Teensy Rotary encoder library is one of only a very libraries purporting to do the same thing to get it right.
However, I know, through speaking in person, to the Arduino project founders, that there is bad blood between the two founders of each project. So maybe this is spilling over in the forum attitude.
I don’t have loyalties to technologies. If it can do what I want or when I was working could make my company money it’s all good. I haven’t been on programming forums for a long time and I guess I forgot how they can be. Thanks for the update.