How differently do we need to configure the MIDI code for the Mega (vs the Due or Uno)?

I've been using a standard MIDI->Hairless->FastLED (WS2812) script for years on both my Due and Uno which both work fantastically.

Once I switched to the Mega, I found that the same code doesn't work. Triggering the Mega with a standard LED script works fine, but once you introduce the MIDI library, everything falls apart.

Has anyone dealt with this issue? Looking online I noticed ppl saying that they have problems with MIDI library on the Mega, but it does not seem conclusive. Should I just give up on the Mega and just get another Due?

// Create the MIDI Instance
#include <MIDI.h>
// #include <MIDI.hpp>
struct CustomBaud : public midi::DefaultSettings {
  static const long BaudRate = BAUDRATE;
};
MIDI_CREATE_CUSTOM_INSTANCE(HardwareSerial, Serial, MIDI, CustomBaud);

void setup() {
  FastLED.addLeds<WS2812B, Pin, GRB>(leds, NumLEDs);
  FastLED.setBrightness(maxBright);
  FastLED.show();

  MIDI.setHandleNoteOn(handleNoteOn);
  MIDI.setHandleNoteOff(handleNoteOff);
  MIDI.setHandleControlChange(handleControlChange);
  MIDI.begin(MIDI_CHANNEL_OMNI);
}

void loop() {
  MIDI.read(); // Check for MIDI messages every loop
}

bump

If it works on an UNO, the same code usually also works on a MEGA, unless it requires low-level access to microcontroller-specific peripherals.
However, keep in mind that MIDI input and WS2812 LEDs don't mix well.

There's not much more I can contribute without seeing the full code and a clearer description than “everything falls apart”.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.