StretchMasterP
New member
Hi,
I am wondering if anyone can help, I been working in a MIDI interface for my Drum Machine project but I have hit an issue with the MIDI in Interface I am building. The Midi out works a treat but the Midi In I am getting lots of messages but i don't seem to see Note ON and Note OFF just lost of type 252 and 224 midi messages. I have highlighted the messages where I did start to press the keys on my keyboard, and there seem to be some other messages coming through. I am using the circuit design from from https://www.pjrc.com/teensy/td_libs_MIDI.html and the code example.
I have tested the continuity and checked the wiring path are correct, even check that the Opto is switching then power applied to the input.
checked the voltages values are correct and getting to the correct places. even reproduced this on a breadboard with the same results.
i have updated my Arduino IDE 1.8.9 and Teensy installer to 1.46 to see if that made a difference but with no luck.
I am at a loss so any ideas or help would be greatly appreciated.
I am wondering if anyone can help, I been working in a MIDI interface for my Drum Machine project but I have hit an issue with the MIDI in Interface I am building. The Midi out works a treat but the Midi In I am getting lots of messages but i don't seem to see Note ON and Note OFF just lost of type 252 and 224 midi messages. I have highlighted the messages where I did start to press the keys on my keyboard, and there seem to be some other messages coming through. I am using the circuit design from from https://www.pjrc.com/teensy/td_libs_MIDI.html and the code example.
Code:
#include <MIDI.h>
MIDI_CREATE_INSTANCE(HardwareSerial, Serial1, MIDI);
void setup() {
MIDI.begin(MIDI_CHANNEL_OMNI);
Serial.begin(57600);
Serial.println("MIDI Input Test");
}
unsigned long t=0;
void loop() {
int type, note, velocity, channel, d1, d2;
if (MIDI.read()) { // Is there a MIDI message incoming ?
byte type = MIDI.getType();
switch (type) {
case midi::NoteOn:
note = MIDI.getData1();
velocity = MIDI.getData2();
channel = MIDI.getChannel();
if (velocity > 0) {
Serial.println(String("Note On: ch=") + channel + ", note=" + note + ", velocity=" + velocity);
} else {
Serial.println(String("Note Off: ch=") + channel + ", note=" + note);
}
break;
case midi::NoteOff:
note = MIDI.getData1();
velocity = MIDI.getData2();
channel = MIDI.getChannel();
Serial.println(String("Note Off: ch=") + channel + ", note=" + note + ", velocity=" + velocity);
break;
default:
d1 = MIDI.getData1();
d2 = MIDI.getData2();
Serial.println(String("Message, type=") + type + ", data = " + d1 + " " + d2);
}
t = millis();
}
if (millis() - t > 10000) {
t += 10000;
Serial.println("(inactivity)");
}
}
checked the voltages values are correct and getting to the correct places. even reproduced this on a breadboard with the same results.
i have updated my Arduino IDE 1.8.9 and Teensy installer to 1.46 to see if that made a difference but with no luck.
I am at a loss so any ideas or help would be greatly appreciated.