I'm just trying to read in some basic MIDI clk messages. I'm using a 2560 reading the MIDI Input on Serial0 and then outputting the data I received on Serial3. I'm then using a FTDI cable and putty to read the data from the 2560.
But I'm not getting any data. The below code will always return "data=0". The MIDI source is a USB to MIDI converter plugged into Ableton. I've tried sending both MIDI Clk and Note On/Off messages but still get the same result. I've also plugged my FTDI cable into where the RX MIDI in pin would go. If I do this my RX light on my FTDI cable flickers with messages but I can't see anything on putty??
Any ideas?
This is the schematic I'm using. Tried reversing pins 4 &5 just in case.
Code:
void setup() {
Serial.begin(31250); //MIDI INPUT
Serial3.begin(19200); // Serial output
Serial3.print("Hi");
Serial3.println();
}byte data; //received MIDI data
byte midi_start = 0xfa;
byte midi_stop = 0xfc;
byte midi_clock = 0xf8;
byte midi_continue = 0xfb;void loop() {
if(Serial.available() > 0) {
data = Serial.read();
Serial3.print("data="); //Serial output MIDI data
Serial3.println(data);
}
}
Cheers.