Problem Midi Input Software With Hiduino And Mega2560

Dear Friend,

I have a big problem…I don’t understand… i have flashed ok my arduino mega 2560 with my program test for output midi…work…i have make some button to control reason5…it’s ok…but when i try to receive from computer to arduino via hiduino to turn on some leds to indicate the notes playing don’t work …do you know this problem??

Can somebody help me please??

i have tryed this code but without success.

#include <MIDI.h>

MIDI_CREATE_INSTANCE(HardwareSerial, Serial, MIDI);
// i have tryed also  MIDI_CREATE_INSTANCE(HardwareSerial, Serial2, MIDI);
// i have tryed also  MIDI_CREATE_INSTANCE();


// -----------------------------------------------------------------------------
// This example shows the old way of checking for input messages.
// It's simpler to use the callbacks now, check out the dedicated example.
#define LED 13                   // LED pin on Arduino Uno
// -----------------------------------------------------------------------------
void BlinkLed(byte num)         // Basic blink function
{
    for (byte i=0;i<num;i++)
    {
        digitalWrite(LED,HIGH);
        delay(50);
        digitalWrite(LED,LOW);
        delay(50);
    }
}
// -----------------------------------------------------------------------------
void setup()
{
    pinMode(LED, OUTPUT);
    MIDI.begin();           // Launch MIDI, by default listening to channel 1.
}
void loop()
{
    if (MIDI.read())                // Is there a MIDI message incoming ?
    {
        switch(MIDI.getType())      // Get the type of the message we caught
        {
            case midi::ProgramChange:       // If it is a Program Change,
                BlinkLed(MIDI.getData1());  // blink the LED a number of times
                                            // correponding to the program number
                                            // (0 to 127, it can last a while..)
                break;
            // See the online reference for other message types
            default:
                break;
        }
    }
}

Thanks in advance,

Lestroso :confused: