Control-Surface icon indicating copy to clipboard operation
Control-Surface copied to clipboard

How to properly use the code for HairlessMIDI and midi 5 pin togeather?

Open e36910 opened this issue 2 years ago • 7 comments

I have 2 exaple HairlessMIDI_Interface midi; // for usb with HairlessMIDI app and USBMIDI_Interface midi; // for midi 5 pin

Separately it works, but when both lines are left, then there is a conflict. What is the right way to write this part of the code so that 2 functions work together?

e36910 avatar Jun 25 '22 13:06 e36910

This depends on the board you're using. On boards without native USB support, both the Hairless and the USBMIDI interfaces use the same Serial UART by default.

USBMIDI_Interface midi; // for midi 5 pin

This doesn't make much sense, if you want an interface for 5-pin MIDI, use the HardwareSerialMIDI_Interface (or any of the other available Serial interfaces: https://tttapa.github.io/Control-Surface-doc/Doxygen/dc/df0/group__MIDIInterfaces.html).

If both work separately, that probably means that you connected your 5-pin MIDI connector to the same UART that is also connected to the on-board UART-to-USB adapter. You cannot use that one UART for both purposes at the same time, you'll have to use a different UART for 5-pin MIDI.

tttapa avatar Jun 25 '22 13:06 tttapa

I have Node mcu V3 8266. I would used one device for PC via USB and for Helix Rack via 5pin midi out.

e36910 avatar Jun 25 '22 13:06 e36910

Then you'll have to use UART1 for 5-pin DIN and UART0 for Hairless.

tttapa avatar Jun 25 '22 14:06 tttapa

How to use it?

e36910 avatar Jun 26 '22 03:06 e36910

Use Serial1: https://arduino-esp8266.readthedocs.io/en/latest/reference.html#serial

tttapa avatar Jun 26 '22 09:06 tttapa

OK thanks. How to correctly write line UART0 for usb and UART1 for midi5 din?

e36910 avatar Jun 27 '22 07:06 e36910

HardwareSerialMIDI_Interface my_midi_uart0 {Serial};
HardwareSerialMIDI_Interface my_midi_uart1 {Serial1};

tttapa avatar Jul 01 '22 23:07 tttapa