Lab_interaccio/2015/test_midi_DUE/test_midi_DUE.ino
2025-02-25 21:29:42 +01:00

30 lines
845 B
C++

#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 &gt;= 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);
}
}