OK, so in version 5.0.2 it does work ! yahoo. I mean everything but the midi-thru, but i do that manually anyway, it wasn't reliable. Had to remove version 4.3.1 or the whole thing won't compile properly of course. For completions sake
USBMIDI_CREATE_DEFAULT_INSTANCE();
#define LED 3
uint8_t channel = 1;
void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity) {
MIDI.sendNoteOn(inNumber, inVelocity, inChannel);
analogWrite(LED, inVelocity * 2);
}
void handleNoteOff(byte inChannel, byte inNumber, byte inVelocity) {
MIDI.sendNoteOff(inNumber, inVelocity, inChannel);
analogWrite(LED, 0);
}
void setup() {
pinMode(LED, OUTPUT);
analogWrite(LED, 200);
delay(1000);
analogWrite(LED, 0);
MIDI.begin();
MIDI.turnThruOff();
MIDI.setHandleNoteOn(handleNoteOn);
MIDI.setHandleNoteOff(handleNoteOff);
}
void loop() {
static uint32_t moment = millis();
static bool noteon = true;
if (millis() - moment > 2000) {
moment = millis();
if (noteon) MIDI.sendNoteOn(64, 127, channel);
else MIDI.sendNoteOff(64, 0, channel);
noteon = !noteon;
}
MIDI.read();
}
Thanks all !