

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



#define BASS 2 // Bass Drum triggered from Arduino Pin 2

#define LCONGA 3 // Low Conga triggered from Arduino Pin 3

#define HCONGA 4 // High Conga triggered from Arduino Pin 4

#define HBONGO 5 // High Bongo triggered from Arduino Pin 5

#define CLAVES 6 // Claves triggered from Arduino Pin 6

#define SNARE 7 // Snare Drum triggered from Arduino Pin 7

#define CYMBAL 8 // Cymbal triggered from Arduino Pin 8



void HandleNoteOn(byte channel, byte pitch, byte velocity){

digitalWrite(BASS, HIGH);

digitalWrite(LCONGA, HIGH);

digitalWrite(HCONGA, HIGH);

digitalWrite(HBONGO, HIGH);

digitalWrite(CLAVES, HIGH);

digitalWrite(SNARE, HIGH);

digitalWrite(CYMBAL, HIGH);

if (pitch == 36) {

digitalWrite(BASS, LOW);

}

if (pitch == 64) {

digitalWrite(LCONGA, LOW);

}

if (pitch == 63) {

digitalWrite(HCONGA, LOW);

}

if (pitch == 60) {

digitalWrite(HBONGO, LOW);

}

if (pitch == 75) {

digitalWrite(CLAVES, LOW);

}

if (pitch == 40) {

digitalWrite(SNARE, LOW);

}

if (pitch == 42) {

digitalWrite(CYMBAL, LOW);

}

}



void setup(){

MIDI.begin(MIDI_CHANNEL_OMNI);

MIDI.setHandleNoteOn(HandleNoteOn);

pinMode(BASS, OUTPUT);

pinMode(LCONGA, OUTPUT);

pinMode(HCONGA, OUTPUT);

pinMode(HBONGO, OUTPUT);

pinMode(CLAVES, OUTPUT);

pinMode(SNARE, OUTPUT);

pinMode(CYMBAL, OUTPUT);

}



void loop(){

MIDI.read();

}



Hi,I'm trying to send triggers to an analog rhythm machine when arduino receives certain midi note numbers. So far I have been successful with the code below; however, each key I press on my midi controller will trigger the sound on the rhythm machine only once! If I press another key and then the desired key, it will trigger again, but I can't trigger the same sound from the same key multiple times in a row. What am I doing wrong!?!?Thanks!Andy