Haha. Touche. So Pro Tools is a DAW or Digital Audio Workstation (Software for recording music). I was originally trying to connect my Arduino, to my Mac Pro via MIDI to USB adapter but soon found that I could transfer MIDI data directly to the Arduino via USB so went that route. The light is connected to a Sainsmart 2 Relay Module which is then connected to the Arduino. It's to my understanding that the set up should be as follows:
Pin 13 to In #1 on the relay
GND to the GND on relay
5v to VCC on relay
I'm then using the Hairless MIDISerial application to run the USB input back into Pro Tools.
The code that I'm using is as follows:
#include <MIDI.h>
//Flash arduino 8u2 or 16u2 chip with HIDUINO_MIDI.hex
//Set ProTools or other DAW to use MIDI controller / HUI protocol / arduino_midi (default hiduino name)
//The two sets of messages that we are looking for are:
// RECORD ON
// 1) channel 1, controller 12, value 14
// 2) channel 1, controller 44, value 69
// RECORD OFF
// 1) channel 1, controller 12, value 14
// 2) channel 1, controller 44, value 5
int firstMsg=0; // set int for the first part of the two messages
MIDI_CREATE_DEFAULT_INSTANCE();
void setup(){
//Use LED for reference
pinMode(13,OUTPUT);
// Listen for MIDI on channel 1 only
MIDI.begin(1);
//Listen for incoming ControlChange MIDI messages and pass bytes to function if received
MIDI.setHandleControlChange(CCSequence);
}
void loop() {
MIDI.read(); // Read all incoming MIDI data
}
//Function that will receive the CC MIDI Bytes
void CCSequence(byte channel, byte controller, byte value ) {
//Check if CC message is equal to the first part of our two sequences:
//1) channel 1, controller 12, value 14
if((channel==1)&&(controller=12)&&(value==14))
{
//Mark first part of the sequence as received
firstMsg=1;
}
//If first part is received look for the second part of our two sequences
if(firstMsg==1)
{
//Check if CC message is the second part of RECORD ON
//2) channel 1, controller 44, value 69
if((channel==1)&&(controller=44)&&(value==69))
{
//Turn LED ON
digitalWrite(13, HIGH);
//Reset Marker. We start waiting for the first part of the sequence again
firstMsg=0;
}
//Check if CC message is the second part of RECORD OFF
//2) channel 1, controller 44, value 5
if((channel==1)&&(controller=44)&&(value==5))
{
//Turn LED OFF
digitalWrite(13, LOW);
//Reset Marker. We start waiting for the first part of the sequence again
firstMsg=0;
}
}
}
Hope this provides some more insight on my current situation. The Arduino that I got is pretty confusing so I'll attach a picture. If you need any other info, let me know.
Thanks in advance!
