Added Teensy examples.
This commit is contained in:
parent
631184953f
commit
c8c4f567be
|
|
@ -0,0 +1,20 @@
|
|||
#include <MIDI.h>
|
||||
|
||||
const int ledPin = 11; // Teensy has LED on 11, Teensy++ on 6
|
||||
|
||||
void setup() {
|
||||
MIDI.begin();
|
||||
pinMode(ledPin,OUTPUT);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
if (MIDI.read()) {
|
||||
digitalWrite(ledPin, HIGH); // set the LED on
|
||||
delay(50); // wait for a second
|
||||
digitalWrite(ledPin, LOW); // set the LED off
|
||||
//delay(100); // wait for a second
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
#include <MIDI.h>
|
||||
|
||||
const int ledPin = 11; // Teensy has LED on 11, Teensy++ on 6
|
||||
|
||||
// NoteOn Callback (will be called upon reception of a NoteOn message
|
||||
void TurnLedOn(byte inChannel,byte inNote,byte inVelocity) {
|
||||
if (inVelocity == 0) {
|
||||
// NoteOn + null velo = note off.
|
||||
digitalWrite(ledPin,LOW);
|
||||
}
|
||||
else digitalWrite(ledPin,HIGH);
|
||||
}
|
||||
|
||||
// NoteOff Callback (will be called upon reception of a NoteOff message
|
||||
void TurnLedOff(byte inChannel,byte inNote,byte inVelocity) {
|
||||
digitalWrite(ledPin,LOW);
|
||||
}
|
||||
|
||||
void setup() {
|
||||
pinMode(ledPin,OUTPUT);
|
||||
MIDI.begin();
|
||||
MIDI.setHandleNoteOn(TurnLedOn); // Connect callback for NoteOn
|
||||
MIDI.setHandleNoteOff(TurnLedOff); // Connect callback for NoteOff
|
||||
}
|
||||
|
||||
void loop() {
|
||||
MIDI.read(); // Keep reading MIDI input
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
#include <MIDI.h>
|
||||
|
||||
const int ledPin = 11; // Teensy has LED on 11, Teensy++ on 6
|
||||
|
||||
void Callback(word data) {
|
||||
digitalWrite(ledPin,HIGH);
|
||||
delay(100);
|
||||
digitalWrite(ledPin,LOW);
|
||||
delay(100);
|
||||
}
|
||||
|
||||
void setup() {
|
||||
pinMode(ledPin,OUTPUT);
|
||||
MIDI.begin(); // Start MIDI on DIN plugs
|
||||
MIDI.setHandleSongPosition(Callback);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
MIDI.read();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
#include <MIDI.h>
|
||||
|
||||
const int ledPin = 11; // Teensy has LED on 11, Teensy++ on 6
|
||||
|
||||
// NoteOn Callback (will be called upon reception of a NoteOn message
|
||||
void TurnLedOn(byte inChannel,byte inNote,byte inVelocity) {
|
||||
if (inVelocity == 0) {
|
||||
// NoteOn + null velo = note off.
|
||||
digitalWrite(ledPin,LOW);
|
||||
}
|
||||
else digitalWrite(ledPin,HIGH);
|
||||
}
|
||||
|
||||
// NoteOff Callback (will be called upon reception of a NoteOff message
|
||||
void TurnLedOff(byte inChannel,byte inNote,byte inVelocity) {
|
||||
digitalWrite(ledPin,LOW);
|
||||
}
|
||||
|
||||
void setup() {
|
||||
pinMode(ledPin,OUTPUT);
|
||||
MIDI.begin();
|
||||
usbMIDI.begin();
|
||||
usbMIDI.setHandleNoteOn(TurnLedOn); // Connect callback for NoteOn
|
||||
MIDI.setHandleNoteOn(TurnLedOn); // Connect callback for NoteOn
|
||||
usbMIDI.setHandleNoteOff(TurnLedOff); // Connect callback for NoteOff
|
||||
MIDI.setHandleNoteOff(TurnLedOff); // Connect callback for NoteOff
|
||||
}
|
||||
|
||||
void loop() {
|
||||
MIDI.read(); // Keep reading MIDI input
|
||||
usbMIDI.read();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue