Im trying to have something like Ableton to trigger 6 solenoids through MIDI. Each note would trigger a specific solenoid.
I have built the circuit but am having troubles reading MIDI from within Arduino. Can someone help me decipher how to use the this library? How do I access the note of an incoming message? The help file is not much use to me.
Without using Midi library, you can test with this sketch :
//variables setup
byte incomingByte;
int statusLed = 13; // select the pin for the LED
//setup: declaring iputs and outputs and begin serial
void setup() {
pinMode(statusLed,OUTPUT); // declare the LED's pin as output
Serial.begin(31250); //start serial with midi baudrate 31250
digitalWrite(statusLed,LOW);
}
void loop () {
if (Serial3.available() > 0) {
incomingByte = Serial3.read();
if (incomingByte != 0xFE)
{
Serial.print("MIDI IN !");
Serial.println(incomingByte, HEX);
}
// wait for as status-byte, channel 1, note on or off
if (incomingByte==0x90)
{
digitalWrite(statusLed, HIGH);
delay(20);
digitalWrite(statusLed, LOW);
delay(1);
}
}
}