Hello!
So, I just stared a project where I want to control a servo-motor with MIDI. I set up a MIDI-receiver circuit (see attachment) and connected it to my Arduino (the data-"output" to RX, 5V to 5V, ground to ground). Then I tried triggering the servo with different MIDI notes but that didn't work somehow. So I downloaded MegunoLink(can be used as a serial monitor @ 31250 Baud) to look what's going on and weirdly I am missing all the data bytes. (see below)
This is my code:
#include <Servo.h>
Servo myservo;
byte commandByte;
byte noteByte;
byte velocityByte;
byte noteOn = 144;
void setup() {
Serial.begin(38400);
myservo.attach(9);
}
void checkMIDI(){
do{
if (Serial.available()){
commandByte = Serial.read();
noteByte = Serial.read();
velocityByte = Serial.read();
}
if(commandByte == noteOn){
Serial.print(commandByte, HEX);
Serial.print(" ");
Serial.print(noteByte, HEX);
Serial.print(" ");
Serial.println(velocityByte, HEX);
}
}
while (Serial.available() > 2);
}
void loop() {
checkMIDI();
}
and this is my output when pressing any note (in this case 5 notes successively):
90 FF FF
90 FF FF
90 FF FF
90 FF FF
90 FF FF
For outputting MIDI I tried my audio interface with Ableton, and directly from my MIDI keyboard so the problem (probably) has to be the circuit or the code.
Why do I receive only the command byte and nothing else? {