#include <MIDI.h>
#define LED 13 // LED pin on Arduino board
void setup() {
pinMode(LED, OUTPUT);
pinMode(2,INPUT);
MIDI.begin(4); // Launch MIDI with default options
// input channel is set to 4
}
void loop() {
if (digitalRead(2)){
digitalWrite(LED,HIGH); // Blink the LED
MIDI.sendNoteOn(42,127,1); // Send a Note (pitch 42, velo 127 on channel 1) // Stop the note
}else{
digitalWrite(LED,LOW);
}
}