NganTing 发表于 2020-4-25 14:39:02

Arduino做midi键盘出现问题

用arduino做的midi键盘,然后用loopmidi来生成port口,然后再用hairlessMidi来转换,但是出现问题,求大神解决!

+0.89 - Warning: got a status byte when we were expecting 1 more data bytes, sending possibly incomplete MIDI message 0x80


可能是串口的收发不稳定?


void setup() {
// Set MIDI baud rate:
Serial.begin(31250);
}

void loop() {
// play notes from F#-0 (0x1E) to F#-5 (0x5A):

    //Note on channel 1 (0x90), some note value (note), middle velocity (0x45):
    noteOn(0x90, 0x3C, 0x45);
    delay(100);
    //Note on channel 1 (0x90), some note value (note), silent velocity (0x00):
    noteOn(0x90, 0x3C, 0x00);
    delay(100);
    Serial.write(cmd, ,pitch, ,velocity);
}

// plays a MIDI note. Doesn't check to see that cmd is greater than 127, or that
// data values are less than 127:
void noteOn(int cmd, int pitch, int velocity) {
Serial.write(cmd);

Serial.write(pitch);

Serial.write(velocity);
}
这是上面的示例程序

帅猫 发表于 2020-5-3 17:56:06

Arduino只有ATMega32U4,ATMega8U4(如Pro mini,Pro micro,Leonardo)才支持USB MIDI哦

gada888 发表于 2020-5-16 18:20:47

arduino leonardo性价比高
页: [1]
查看完整版本: Arduino做midi键盘出现问题