USB MIDI - how does serial monitor in PrintIncoming work?

Status
Not open for further replies.

timg11

Member
I just got my Teensy 3.1 and I'm experimenting with the USB MIDI library and the examples.

In the PrintIncoming sketch, it uses the "Arduino Serial Monitor" (Serial.print) to print out incoming MIDI. I understand that the USB MIDI library changes the USB function so the Teensy appears to the host OS as a class compliant MIDI device, and there is no longer a host serial port. So where does serial.print go to in this sketch? One of the on-board serial ports TX1, TX2, or TX3? If so , which one? I don't see any code for pin configuration, so I'm thinking that's not it.

How do I connect something to the serial monitor when using USB MIDI?
 
Perhaps you are familiar with Arduino boards, which use the on-chip serial to do all USB connection? This is why Arduino boards always show up as a serial port, and why many Arduino sketches use a software implementastion of a second serial port to do things like MIDI (over DIN). You may also have come across code that reflashes the Arduino Serial-to-USB chip to be a USB MIDI device (which then prevents it being used for programming, until it is flashed back).

Those complications don't apply here.

Teensy boards on the other hand have a native USB capability and do not need a serial to USB converter chip. Most of the time, the USB is configured as a Human Interface Device (HID). This is why it shows up at the bottom corner of the Arduino windows as "Teensy on (USB port) rather than "on COM9" or whatever.

This also means that the native serial pins are available for other uses (such as MIDI over DIN, talking to other boards, etc). The hardware serial port (or ports, Teensy 3 has three of them) have numbers appended to them: Serial1, Serial2 and so on. These serial ports, and the pins for them, are entirely separate from communication over USB.

When you configure a Teensy to be USB MIDI (or USB keyboard, or whatever) it can still talk to the Arduino serial monitor, using HID. For backwards compatibility with the huge number of Arduino sketches which talk to the serial monitor, this is still done using "Serial" in your sketch. The only difference you will see is that the baud rate (like 9600) is ignored.
 
Status
Not open for further replies.
Back
Top