Closed Taroc22 closed 1 month ago
Hi @Taroc22
Short answer: yes, MIDI.read() is mandatory
Somewhat longer answer: MIDI.read() is the entry point for the central message pump of the MIDI system. It checks for available incoming bytes and parses it. It also calls the callback (setHandleSystemExclusive()). MIDI.read() is fairly optimized and does (almost) not take time if nothing is available (a minimum amount of overhead when no messages are incoming).
Hope this helps. Just keep MIDI.read()
Thanks for the fast and clear answer, you helped me a lot👍
Hey, maybe you can take some of your time looking into my problem.
I am using an Arduino Due to receive MSC data (SysEx Messages) from the MA2 onPC Software. I only want to read this data by using the .setHandleSystemExclusive() function and not have to call MIDI.read() additionally in the loop function because i don't need to read other midi data than SysEx. The problem that occurs if i leave MIDI.read() out is that the ma2 onPC Software crashes. If the line is left in the code, everything works perfectly. Is it really absolutely necessary to call .read() periodically to clear some buffer or something?
include
USBMIDI_CREATE_DEFAULT_INSTANCE();
void setup() { MIDI.begin(1); } void loop() { MIDI.read(); //If this line is left out, the program crashes }
I would really appreciate a helpful answer and thank you for investing the time in creating this library👍