MIDI.getSysExArray - How to record the entire array?

Hi,
I'm new here and also a newbe with arduino stuff and programming.Until now, I found how to proceed with my project, and that is thanks to this forum. So I would like first to say thanks :slight_smile: :)!

Then, I'm working MIDI device controler project, with the Arduino MIDI Library Version 3.2.

Now, I don't find a way to store in an array the entire SysEx array comming from my midi device.
I however do get the correct SysEx array length with the following:

#include <LiquidCrystal.h>
#include <MIDI.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() 
{
lcd.begin(16, 2);
MIDI.begin(MIDI_CHANNEL_OMNI);
}
void loop() 
{
MIDI.read();
[b]unsigned int a = MIDI.getSysExArrayLength ();[/b]
lcd.setCursor(0,0);
lcd.print(a);
lcd.print(" ");
}

But now, I also would like the entire Sysex Message array to be stored in a variable, and I don't succeed... I tried with the following:

byte * Myarray = MIDI.getSysExArray();

There is an error message when compiling the sketch which is:"error: invalid conversion from 'const byte*' to 'byte*'"

I also tried to do it without the pointer:

byte Myarray[] = MIDI.getSysExArray();

And now the error is: "initializer fails to determine size of 'Myarray'"

Ok so I will give the size :

unsigned int a = MIDI.getSysExArrayLength ();
byte Myarray[a] = MIDI.getSysExArray();

And another error appears: "variable-sized object 'Myarray' may not be initialized"

If someone could tell me "how to", that would be very nice :slight_smile:

Lionel

The library shows that the method signature is:

	const byte * getSysExArray() const;

So, you should be able to:

const byte *pMsg = MIDI.getSysExArray();

Oh Thank you so much Paul that works :smiley: :smiley: :smiley:
Cheers,
Lionel