MIDI-to-trigger project not working with DAW

I built an analog drum machine that uses 9-volt pulses to trigger the drum sounds, but wanted to be able to trigger it with MIDI, too. I used an Uno R3 board and a store-bought MIDI shield. Finally got all the bugs worked out of my sketch, hooked it up (via MIDI) to a small Yamaha CS synthesizer. Works perfectly. All the drum sounds trigger from the keyboard's MIDI out.

Then, I hooked it up to my MacBook running Logic Pro through a Focusrite Scarlett 4i4 interface. The MIDI out from Logic Pro only occasionally (and randomly) triggers the drum sounds. The Yamaha CS receives MIDI perfectly from Logic Pro. Puzzling.

Any thoughts or direction would be greatly appreciated!

#include <MIDI.h>  // Add Midi Library

#define pin5 5    // Set Pin 5
#define pin6 6    // Set Pin 6
#define pin7 7    // Set Pin 7
#define pin8 8    // Set Pin 8

//Create an instance of the library with default name, serial port and settings
MIDI_CREATE_DEFAULT_INSTANCE();

void setup() {
  pinMode (pin5, OUTPUT); // Set Arduino board pin 5 to output
  pinMode (pin6, OUTPUT); // Set Arduino board pin 6 to output
  pinMode (pin7, OUTPUT); // Set Arduino board pin 7 to output
  pinMode (pin8, OUTPUT); // Set Arduino board pin 8 to output
  MIDI.begin(1); // Initialize the Midi Library.
  // OMNI sets it to listen to all channels.. MIDI.begin(2) would set it 
  // to respond to notes on channel 2 only.
  Serial.begin(31250);
  MIDI.turnThruOff();
  MIDI.setHandleNoteOn(MyHandleNoteOn); // This is important!! This command
  // tells the Midi Library which function you want to call when a NOTE ON command
  // is received. In this case it's "MyHandleNoteOn".
  MIDI.setHandleNoteOff(MyHandleNoteOff); // This command tells the Midi Library 
  // to call "MyHandleNoteOff" when a NOTE OFF command is received.
}

void loop() { // Main loop
  MIDI.read(); // Continuously check if Midi data has been received.
}

// MyHandleNoteON is the function that will be called by the Midi Library
// when a MIDI NOTE ON message is received.
// It will be passed bytes for Channel, Pitch, and Velocity
void MyHandleNoteOn(byte channel, byte pitch, byte velocity) {
if (pitch == 60)
  digitalWrite(pin5,HIGH);  //Turn pin5 on
if (pitch == 62)
  digitalWrite(pin6,HIGH);  //Turn pin6 on
if (pitch == 64)
  digitalWrite(pin7, HIGH);  //Turn pin7 on
if (pitch == 65)
  digitalWrite(pin8, HIGH);  //Turn pin8 on
}

// MyHandleNoteOFF is the function that will be called by the Midi Library
// when a MIDI NOTE OFF message is received.
// * A NOTE ON message with Velocity = 0 will be treated as a NOTE OFF message *
// It will be passed bytes for Channel, Pitch, and Velocity
void MyHandleNoteOff(byte channel, byte pitch, byte velocity) {
if (pitch == 60)
  digitalWrite(pin5, LOW);  //Turn pin5 off
if (pitch == 62)
  digitalWrite(pin6,LOW);  //Turn pin6 off
if (pitch == 64)
  digitalWrite(pin7, LOW);  //Turn pin7 off
if (pitch == 65)
  digitalWrite(pin8, LOW);  //Turn pin8 off
}