Hi there,
I made up a simple wiring like shown here in the MIDI tutorial (arduino.cc/en/tutorial/midi).
I tried different UNOs and a Mega 2560, all cheap chinese replicas.
Here is my code (last try on the Mega with Serial1):
void setup() {
Serial1.begin(31250);
}
void loop() {
sendMIDI(144, 136, 0);
delay(500);
}
void sendMIDI(byte statusByte, byte dataByte1, byte dataByte2) {
Serial1.write(statusByte);
Serial1.write(dataByte1);
Serial1.write(dataByte2);
}
So I want to send a NoteOn every 500 milliseconds.
I have a Edirol USB MIDI/Soundboard to my PC and running MIDI-OX as monitor.
I am expecting a MIDI-Input of 90-88-0 but what I get is constantly F3, 00, --(ignored).
When I change the 144 to a different value, a totally different statusByte is sent.
When I make a loopp rising the notenumber++ it gives total different statuasBytes, changing all the time.
Writing directly in hex Serial1.write(0x90); gives the same F3.
I played around with using SoftwareSerial and finally using the diffferent Serial outputs of the Mega. All the same.
When I change the serial speed of 31250 to another value, different Bytes are saent, not F3 but constantly another status byte (and different dataBytes).
When I connect a keyboard to the MIDI-Interface and play notes, everything is like expected, so the MIDI-interface seems to be ok.
So what's the problem? Do the chinese Arduinos have a problem with 31250 baud or what am I missing?
I am working on this since hours and am a bit frustrated...