30 lines
845 B
Arduino
30 lines
845 B
Arduino
|
#include <MIDI.h>
|
||
|
|
||
|
int pp =0;
|
||
|
#define LED 13 // LED pin on Arduino board
|
||
|
|
||
|
// Settings for MIDI library v4.0 an upper
|
||
|
struct MySettings : public midi::DefaultSettings{
|
||
|
static const bool UseRunningStatus = false; // Messes with my old equipment!
|
||
|
};
|
||
|
|
||
|
MIDI_CREATE_CUSTOM_INSTANCE(HardwareSerial, Serial, MIDI, MySettings);
|
||
|
// End settings MIDI >= v4.0
|
||
|
|
||
|
void setup() {
|
||
|
pinMode(LED, OUTPUT);
|
||
|
MIDI.begin(4); // Launch MIDI with default options
|
||
|
// input channel is set to 4
|
||
|
}
|
||
|
|
||
|
void loop() {
|
||
|
for (pp=60;pp<=81;pp++){
|
||
|
digitalWrite(LED,HIGH); // Blink the LED
|
||
|
MIDI.sendNoteOn(pp,127,1); // Send a Note (pitch 42, velo 127 on channel 1)
|
||
|
delay(80); // Wait
|
||
|
MIDI.sendNoteOff(pp,128,1); // Stop the note
|
||
|
digitalWrite(LED,LOW);
|
||
|
delay(50);
|
||
|
}
|
||
|
}
|