user47107: Currently trying to get a teensy 3.5 to spam a series of notes in a loop over USB and hardware serial, which I am pretty sure it can do. 
I have a MIDI circuit set up as per the specifications here: 
https://www.pjrc.com/teensy/td_libs_MIDI.html
And currently have it booping a looping grouping of notes through massive embedded in ableton over a 5 PIN DIN circuit feeding into a generic MIDI 5 Pin DIN -> USB converter. 
 #include <MIDI.h>

#define HWSerial Serial1
MIDI_CREATE_INSTANCE(HardwareSerial, Serial1, MIDI);
const int channel = 1;

void setup() {

  HWSerial.begin(9600);
  MIDI.begin();
}

void loop() {
  int note;
  for (note=10; note <= 127; note++) {
    MIDI.sendNoteOn(note, 100, channel);
    delay(200);
    MIDI.sendNoteOff(note, 100, channel);
  }
  delay(2000);
}

I am lead to believe that when working with the USB serial output on the teensy you simply refer to the port as 'Serial' and for the others it's 'Serial1', 'Serial2', and so on. 
I have tried using serial in place of the arguments within MIDI_CREATE_INSTANCE
and also tried using MIDI_CREATE_DEFAULT_INSTANCE which should do this setup on the default serial port, which I assume is USB? (This worked fine on my arduino mega setup where I was using the 16u2 chip as a serial -> USB midi converter as per this method: https://github.com/ddiakopoulos/hiduino) 
I'm just a little stumped as I have managed to get the code to compile using default instance and it appears as a midi device in windows device manager and also in ableton when I set USB Type: Serial + MIDI from arduinos tools dropdown box but does not output any notes :( 
Can anyone help me get this working? 
I'm currently toying with:
    #include <MIDI.h>

const int channel = 1;

void setup() 
{

}

void loop() 
{
  int note;
  for (note=20; note <= 63; note++) // Range was changed from 10:127 to save eardrums. 
  {
    usbMIDI.sendNoteOn(note, 100, channel);
    delay(200);
    usbMIDI.sendNoteOff(note, 100, channel);
  }
  delay(2000);
}

but get
    C:\Users\Jamie\AppData\Local\Temp\arduino_build_144363/..\arduino_cache_283435\core\core_teensy_avr_teensy35_usb_serialmidi,speed_120,opt_o2std,keys_en-us_4939f5412a75a8560acb0f9e98268f02.a(pins_teensy.c.o): In function `_init_Teensyduino_internal_':

C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/pins_teensy.c:582: undefined reference to `analog_init'

collect2.exe: error: ld returned 1 exit status

Error compiling for board Teensy 3.5.

and if I try inluding 'usbMIDI' I get 
F:\GigaTech\MMMM_Beta_Code\debug\TeensyUSBMIDILoopTest\TeensyUSBMIDILoopTest.ino:1:21: fatal error: usbMIDI.h: No such file or directory

compilation terminated.

Error compiling for board Teensy 3.5.

although midiUSB is definitely installed :S

------------------------------C O N T I N U E D ----------------------------
Ok so I now have a working sketch for both USB and Hardware MIDI comms but I can't seem to get them to work simultaneously. 
My code for the hardware is as shown above, and the USB method is below:
 #include <MIDI.h>

MIDI_CREATE_INSTANCE(HardwareSerial, Serial1, MIDI);
const int channel = 1;

void setup() {
  MIDI.begin();
}

void loop() {
  int note;
  for (note=10; note <= 127; note++) 
  {
    usbMIDI.sendNoteOn(note, 100, channel);
    delay(200);
    usbMIDI.sendNoteOff(note, 100, channel);
  }
  delay(2000);
}

I sort of assumed it would be possible to do something like this: 
 #include <MIDI.h>

#define HWSerial Serial1
MIDI_CREATE_INSTANCE(HardwareSerial, Serial, MIDI); // 5 Pin DIN Out
const int channel = 1;

void setup() 
{  
  HWSerial.begin(9600);
  MIDI.begin();  
}

void loop() {
  int note;
  for (note=20; note <= 63; note++) // Range was changed from 10:127 to save eardrums. 
  {
    usbMIDI.sendNoteOn(note, 100, channel);
    MIDI.sendNoteOn(note, 100, channel);
    delay(200);
    usbMIDI.sendNoteOff(note, 100, channel);
    MIDI.sendNoteOff(note, 100, channel);
  }
  delay(2000);
}

But It doesn't seem to work. 
The code compiles and uploads just fine, however, ableton only sees MIDI messages coming over the teensy usb port and not through my MIDI receiver. 
I wondered if this is because the two are both being routed to my PC via a usb port but this shouldn't be a problem surely. 
I have also tried assigning the USB and hardware MIDI sends to different channels but to no avail.
I would love to get these both working simultaneously. 

user37857: Just use usbMidi.
#include <MIDI.h>

MIDI_CREATE_INSTANCE(HardwareSerial, Serial1, MIDI);
const int channel = 1;

void setup() {
  MIDI.begin();
}

void loop() {
  int note;
  for (note=10; note <= 127; note++) {
    MIDI.sendNoteOn(note, 100, channel);
    usbMIDI.sendNoteOn(note, 100, channel);
    delay(200);
    MIDI.sendNoteOff(note, 100, channel);
    usbMIDI.sendNoteOff(note, 100, channel);
  }
  delay(2000);
}


47107: <p>Currently trying to get a teensy 3.5 to spam a series of notes in a loop over USB and hardware serial, which I am pretty sure it can do. </p>

<p>I have a MIDI circuit set up as per the specifications here: 
<a href="https://www.pjrc.com/teensy/td_libs_MIDI.html" rel="nofollow noreferrer">https://www.pjrc.com/teensy/td_libs_MIDI.html</a>
And currently have it booping a looping grouping of notes through massive embedded in ableton over a 5 PIN DIN circuit feeding into a generic MIDI 5 Pin DIN -> USB converter. </p>

<pre><code> #include &lt;MIDI.h&gt;

#define HWSerial Serial1
MIDI_CREATE_INSTANCE(HardwareSerial, Serial1, MIDI);
const int channel = 1;

void setup() {

  HWSerial.begin(9600);
  MIDI.begin();
}

void loop() {
  int note;
  for (note=10; note &lt;= 127; note++) {
    MIDI.sendNoteOn(note, 100, channel);
    delay(200);
    MIDI.sendNoteOff(note, 100, channel);
  }
  delay(2000);
}
</code></pre>

<p>I am lead to believe that when working with the USB serial output on the teensy you simply refer to the port as 'Serial' and for the others it's 'Serial1', 'Serial2', and so on. </p>

<p>I have tried using serial in place of the arguments within MIDI_CREATE_INSTANCE
and also tried using MIDI_CREATE_DEFAULT_INSTANCE which should do this setup on the default serial port, which I assume is USB? (This worked fine on my arduino mega setup where I was using the 16u2 chip as a serial -> USB midi converter as per this method: <a href="https://github.com/ddiakopoulos/hiduino" rel="nofollow noreferrer">https://github.com/ddiakopoulos/hiduino</a>) </p>

<p>I'm just a little stumped as I have managed to get the code to compile using default instance and it appears as a midi device in windows device manager and also in ableton when I set USB Type: Serial + MIDI from arduinos tools dropdown box but does not output any notes :( </p>

<p>Can anyone help me get this working? </p>

<p>I'm currently toying with:</p>

<pre><code>    #include &lt;MIDI.h&gt;

const int channel = 1;

void setup() 
{

}

void loop() 
{
  int note;
  for (note=20; note &lt;= 63; note++) // Range was changed from 10:127 to save eardrums. 
  {
    usbMIDI.sendNoteOn(note, 100, channel);
    delay(200);
    usbMIDI.sendNoteOff(note, 100, channel);
  }
  delay(2000);
}
</code></pre>

<p>but get</p>

<pre><code>    C:\Users\Jamie\AppData\Local\Temp\arduino_build_144363/..\arduino_cache_283435\core\core_teensy_avr_teensy35_usb_serialmidi,speed_120,opt_o2std,keys_en-us_4939f5412a75a8560acb0f9e98268f02.a(pins_teensy.c.o): In function `_init_Teensyduino_internal_':

C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/pins_teensy.c:582: undefined reference to `analog_init'

collect2.exe: error: ld returned 1 exit status

Error compiling for board Teensy 3.5.
</code></pre>

<p>and if I try inluding 'usbMIDI' I get </p>

<pre><code>F:\GigaTech\MMMM_Beta_Code\debug\TeensyUSBMIDILoopTest\TeensyUSBMIDILoopTest.ino:1:21: fatal error: usbMIDI.h: No such file or directory

compilation terminated.

Error compiling for board Teensy 3.5.
</code></pre>

<p>although midiUSB is definitely installed :S</p>

<hr>

<h2>------------------------------C O N T I N U E D ----------------------------</h2>

<p>Ok so I now have a working sketch for both USB and Hardware MIDI comms but I can't seem to get them to work simultaneously. 
My code for the hardware is as shown above, and the USB method is below:</p>

<pre><code> #include &lt;MIDI.h&gt;

MIDI_CREATE_INSTANCE(HardwareSerial, Serial1, MIDI);
const int channel = 1;

void setup() {
  MIDI.begin();
}

void loop() {
  int note;
  for (note=10; note &lt;= 127; note++) 
  {
    usbMIDI.sendNoteOn(note, 100, channel);
    delay(200);
    usbMIDI.sendNoteOff(note, 100, channel);
  }
  delay(2000);
}
</code></pre>

<p>I sort of assumed it would be possible to do something like this: </p>

<pre><code> #include &lt;MIDI.h&gt;

#define HWSerial Serial1
MIDI_CREATE_INSTANCE(HardwareSerial, Serial, MIDI); // 5 Pin DIN Out
const int channel = 1;

void setup() 
{  
  HWSerial.begin(9600);
  MIDI.begin();  
}

void loop() {
  int note;
  for (note=20; note &lt;= 63; note++) // Range was changed from 10:127 to save eardrums. 
  {
    usbMIDI.sendNoteOn(note, 100, channel);
    MIDI.sendNoteOn(note, 100, channel);
    delay(200);
    usbMIDI.sendNoteOff(note, 100, channel);
    MIDI.sendNoteOff(note, 100, channel);
  }
  delay(2000);
}
</code></pre>

<p>But It doesn't seem to work. 
The code compiles and uploads just fine, however, ableton only sees MIDI messages coming over the teensy usb port and not through my MIDI receiver. 
I wondered if this is because the two are both being routed to my PC via a usb port but this shouldn't be a problem surely. 
I have also tried assigning the USB and hardware MIDI sends to different channels but to no avail.</p>

<p>I would love to get these both working simultaneously. </p>
 37857: <p>Just use <a href="https://www.pjrc.com/teensy/td_midi.html" rel="nofollow noreferrer">usbMidi</a>.</p>

<pre><code>#include &lt;MIDI.h&gt;

MIDI_CREATE_INSTANCE(HardwareSerial, Serial1, MIDI);
const int channel = 1;

void setup() {
  MIDI.begin();
}

void loop() {
  int note;
  for (note=10; note &lt;= 127; note++) {
    MIDI.sendNoteOn(note, 100, channel);
    usbMIDI.sendNoteOn(note, 100, channel);
    delay(200);
    MIDI.sendNoteOff(note, 100, channel);
    usbMIDI.sendNoteOff(note, 100, channel);
  }
  delay(2000);
}
</code></pre>
