Cliff Montgomery
Member
I'm trying to run the MIDI Library's Basic_IO example on a Teensy 4.1.
On the Arduino IDE "Tools / USB Type" menu I've selected "Serial + MIDI".
I modified the sketch Loop so that it continually sends notes and flashes the LED on one second intervals.
I have a MIDI Monitor program running on my PC.
The Monitor recognizes the "Teensy MIDI" but does not see any messages coming from it. I also tried it with "Serial + MIDI4" selected.
The Monitor responds to a keyboard I have also connected, so I know it is working correctly.
I'll post the sketch code below.
Any ideas?
Here is the sketch code:
#include <MIDI.h>
// Simple tutorial on how to receive and send MIDI messages.
// Here, when receiving any message on channel 4, the Arduino
// will blink a led and play back a note for 1 second.
MIDI_CREATE_DEFAULT_INSTANCE();
void setup()
{
pinMode(LED_BUILTIN, OUTPUT);
MIDI.begin(4); // Launch MIDI and listen to channel 4
digitalWrite(LED_BUILTIN, HIGH);
MIDI.sendNoteOn(42, 127, 1); // Send a Note (pitch 42, velo 127 on channel 1)
delay(1000); // Wait for a second
MIDI.sendNoteOff(42, 0, 1); // Stop the note
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
digitalWrite(LED_BUILTIN, HIGH);
MIDI.sendNoteOn(58, 127, 1); // Send a Note (pitch 42, velo 127 on channel 1)
delay(1000); // Wait for a second
MIDI.sendNoteOff(58, 0, 1); // Stop the note
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}
void loop()
{
//if (MIDI.read()) // (Loop continually) If we have received a message
{
digitalWrite(LED_BUILTIN, HIGH);
MIDI.sendNoteOn(42, 127, 1); // Send a Note (pitch 42, velo 127 on channel 1)
delay(1000); // Wait for a second
MIDI.sendNoteOff(42, 0, 1); // Stop the note
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
digitalWrite(LED_BUILTIN, HIGH);
MIDI.sendNoteOn(58, 127, 1); // Send a Note (pitch 42, velo 127 on channel 1)
delay(1000); // Wait for a second
MIDI.sendNoteOff(58, 0, 1); // Stop the note
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}
}
On the Arduino IDE "Tools / USB Type" menu I've selected "Serial + MIDI".
I modified the sketch Loop so that it continually sends notes and flashes the LED on one second intervals.
I have a MIDI Monitor program running on my PC.
The Monitor recognizes the "Teensy MIDI" but does not see any messages coming from it. I also tried it with "Serial + MIDI4" selected.
The Monitor responds to a keyboard I have also connected, so I know it is working correctly.
I'll post the sketch code below.
Any ideas?
Here is the sketch code:
#include <MIDI.h>
// Simple tutorial on how to receive and send MIDI messages.
// Here, when receiving any message on channel 4, the Arduino
// will blink a led and play back a note for 1 second.
MIDI_CREATE_DEFAULT_INSTANCE();
void setup()
{
pinMode(LED_BUILTIN, OUTPUT);
MIDI.begin(4); // Launch MIDI and listen to channel 4
digitalWrite(LED_BUILTIN, HIGH);
MIDI.sendNoteOn(42, 127, 1); // Send a Note (pitch 42, velo 127 on channel 1)
delay(1000); // Wait for a second
MIDI.sendNoteOff(42, 0, 1); // Stop the note
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
digitalWrite(LED_BUILTIN, HIGH);
MIDI.sendNoteOn(58, 127, 1); // Send a Note (pitch 42, velo 127 on channel 1)
delay(1000); // Wait for a second
MIDI.sendNoteOff(58, 0, 1); // Stop the note
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}
void loop()
{
//if (MIDI.read()) // (Loop continually) If we have received a message
{
digitalWrite(LED_BUILTIN, HIGH);
MIDI.sendNoteOn(42, 127, 1); // Send a Note (pitch 42, velo 127 on channel 1)
delay(1000); // Wait for a second
MIDI.sendNoteOff(42, 0, 1); // Stop the note
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
digitalWrite(LED_BUILTIN, HIGH);
MIDI.sendNoteOn(58, 127, 1); // Send a Note (pitch 42, velo 127 on channel 1)
delay(1000); // Wait for a second
MIDI.sendNoteOff(58, 0, 1); // Stop the note
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}
}