I'm trying to get incoming MIDI CC messages via serial, and transmit them out of another.
I have some devilishly simple code that isn't performing at all.
byte data;
void setup() {
Serial1.begin(31250);
Serial2.begin(31250);
}
void checkMIDI() {
if (Serial1.available() > 0) {
data = Serial1.read();
if (data == 176) {
Serial2.write(Serial1.read());
}
}
}
void loop() {
checkMIDI();
}
When I check MIDI monitor connected to Serial2, the only readings I get are FF over and over again when I change a MIDI CC value.
I would expect to get 45 - or the hex value - as I am tweaking cutoff, followed by the value.
The significance of 176 is the first byte of a message containing MIDI CC on channel 1.
Thanks for your help in this deep confusion...
EDIT:
Synth attached is outputting MIDI clock pulses... I can see this if I pass through all MIDI info... It hits me with F8, which is a MIDI clock pulse.
It seems like something is interfering with MIDI, as even the simple code below causes an endless stream of FF:
void setup() {
Serial3.begin(31250);
Serial2.begin(31250);
}
void loop() {
Serial2.write(Serial3.read());
}