Create NoteNames.ino
demonstrate use of MIDI_NAMESPACE::NoteValues[inNote].strptr
This commit is contained in:
parent
e79fb67d17
commit
0f74f054b6
|
|
@ -0,0 +1,34 @@
|
|||
#include <MIDI.h>
|
||||
|
||||
MIDI_CREATE_DEFAULT_INSTANCE();
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// This function will print the name of th note played.
|
||||
// (check the callback example for more details on callbacks)
|
||||
|
||||
void handleNoteOn(byte inChannel, byte inNote, byte inVelocity)
|
||||
{
|
||||
Serial.print("Note On: ");
|
||||
Serial.println(MIDI_NAMESPACE::NoteValues[inNote].strptr);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
while (!Serial);
|
||||
Serial.println("Arduino Ready");
|
||||
|
||||
MIDI.setHandleNoteOn(handleNoteOn); // Put only the name of the function
|
||||
|
||||
// Initiate MIDI communications, listen to all channels
|
||||
MIDI.begin(MIDI_CHANNEL_OMNI);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
// Call MIDI.read the fastest you can for real-time performance.
|
||||
MIDI.read();
|
||||
}
|
||||
Loading…
Reference in New Issue