Go Down

Topic: MIDI in problem (Read 1 time) previous topic - next topic



I've been struggling with this for a while now. My goal is to make a metronome out of LEDs controlled by an Arduino Mega. The Mega receives midi data through serial by using Serial Midi Converter by Spiekenzielabs (http://www.spikenzielabs.com/SpikenzieLabs/Serial_MIDI.html). I started experimenting with the code by Kuk (http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1187962258/0). At first I got nothing - no blinking leds even though serial was being transmitted (I debugged this by turning a status led on when serial.available > 0). I suspected the problem was with the line

Code: [Select]
if (incomingByte== 144){ // note on message starting starting

It really makes no sense, since I specifically sent a note on command (144) from Ableton Live. Then I tried this

Code: [Select]
if (incomingByte > 144){ // note on message starting starting

Which resulted in the condition coming through and I got a blinking led. I started tracing the incoming command by narrowing the byte to smaller and smaller ranges and finally got down to it being 252 - the midi command for STOP. What the..?

I just want to define four notes which would light up corresponding leds on the Arduin metronome. Any help?


As you haven't posted the code it is hard to say but MIDI consists of messages, each message is more than one byte. You have to synchronise the receiving stream so that you know that the byte you are looking at is the first one in the message.

The code in this project shows you haw it is done.

Go Up