Problema con MIDI

Buenos días,

Estoy trabajando en proyecto con midi y no consigo programar una orden de NoteOff, para cerrar el PIN 13.

    byte type;

    byte channel;

    byte data1;

    byte data2;

    void setup() {

    // Set MIDI baud rate:

    Serial.begin(31250);

    pinMode(13,OUTPUT);

    }

    void loop() {

    channel=0;

    type=0;

    data1=0;

    data2=0;

    readMIDI(&channel,&type, &data1,&data2);

    //type 0x90: Note On

    //data1 60: C4

    if ((channel==1)&&(type==0x90)&&(data1==80)&&(data2==1)){

    digitalWrite(13,HIGH);
    
    }

    else if ((channel==1)&&(type==0x80)&&(data1==80)&&(data2==0)){

    digitalWrite(13,LOW);

    }

    }

    void readMIDI(byte* channel ,byte* type, byte* data1, byte* data2)

    {

    int aux;

    while (Serial.available()>0){

    aux=Serial.read();

    if ((aux >= B10000000)&&(aux <= B11101111)){

    // Si es byte STATUS legal:

    *channel=(aux&B00001111)+1; //canales entre 1 y 16

    *type=(aux&B11110000);

    // Esperamos porque si aún no han llegado los datos,

    // los Serial.read() devolverán -1:

    while (Serial.available() < 2){

    }

    *data1 = Serial.read();

    *data2 = Serial.read();

    }

    }

    }

Un saludo y gracias