Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
31 lines (25 sloc) 532 Bytes
// USB MIDI receive example, Note on/off -> LED on/off
// contributed by Alessandro Fasan
int ledPin = 13;
void OnNoteOn(byte channel, byte note, byte velocity)
{
digitalWrite(ledPin, HIGH);
}
void OnNoteOff(byte channel, byte note, byte velocity)
{
digitalWrite(ledPin, LOW);
}
void setup()
{
pinMode(ledPin, OUTPUT);
usbMIDI.setHandleNoteOff(OnNoteOff);
usbMIDI.setHandleNoteOn(OnNoteOn) ;
digitalWrite(ledPin, HIGH);
delay(1000);
digitalWrite(ledPin, LOW);
delay(1000);
}
void loop()
{
usbMIDI.read();
}