Created
February 24, 2020 15:59
-
-
Save tadfmac/941e6390d68ca35c997a8025081e4c72 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// for Pro Micro | |
#include "MIDIUSB.h" | |
void setup() { | |
pinMode(11,OUTPUT); | |
} | |
void loop() { | |
midiEventPacket_t rx; | |
do { | |
rx = MidiUSB.read(); | |
if (rx.header != 0) { | |
if(((rx.byte1) & 0xF0) == 0x90){ // Note On | |
if(rx.byte3 != 0){ // Note On | |
digitalWrite(11,HIGH); | |
}else{ // Note OFF | |
digitalWrite(11,LOW); | |
} | |
}else if(((rx.byte1) & 0xF0) == 0x80){ // Note OFF | |
digitalWrite(11,LOW); | |
} | |
} | |
} while (rx.header != 0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment