Hab nochmals eine Frage zu meinem serial.read()
void SerialLesen() {
if (Serial2.available()==3) {
delay (2);
commandByte = Serial2.read();
delay (2);
channelByte = Serial2.read();
delay (2);
statusByte = Serial2.read(); {while (Serial2.available() ==1); }
}
}
erst lese ich die daten, dann "tu etwas"
void checkMIDI()
{
if ((commandByte == cc)&& (channelByte == 22)&& (statusByte == 1)){digitalWrite(8,HIGH);}
if ((commandByte == cc)&& (channelByte == 22)&& (statusByte == 0)){digitalWrite(8,LOW);}
if ((commandByte == cc)&& (channelByte == 23)&& (statusByte == 1)){digitalWrite(9,HIGH);}
if ((commandByte == cc)&& (channelByte == 23)&& (statusByte == 0)){digitalWrite(9,LOW);}
if ((commandByte == cc)&& (channelByte == 24)&& (statusByte == 1)){digitalWrite(10,HIGH);}
if ((commandByte == cc)&& (channelByte == 24)&& (statusByte == 0)){digitalWrite(10,LOW);}
if ((commandByte == cc)&& (channelByte == 25)&& (statusByte == 1)){digitalWrite(11,HIGH);}
if ((commandByte == cc)&& (channelByte == 25)&& (statusByte == 0)){digitalWrite(11,LOW);}
}
wenn ich vom Controller zufällig zwei Signale (fast zeitgleich) bekomme, dann hängt sich die read funktion auf.
ich weiß nur nicht warum?
Hat jemand eine Idee?