Serial() vs SerialUSB()..... Using Arduino YUN

I am trying to figure out the specific difference between Serial() and SerialUSB().

Functionally both of these objects appear to do the same thing.

Specifically I am trying to write data directly to a USB stick on my YUN. Anyone got a good link or explanation for the difference.


SerialUSB is to access the USB port on a SAM3X chip, which is not the type of processor on the Yun. So it does not apply.

On the Yun, Serial allows communications with a host computer over the micro-USB connector.

Neither of these are applicable for accessing a USB stick drive.

Such a drive needs to be connected to the USB Type A Host port, which is managed by the Linux system. The sketch has no direct access to it. A sketch can read/write files on a USB using the Bridge Library's FileIO class. But it is much simpler, faster, and more powerful to do any file reading/writing directly from Linux.

With an idea of what data you are trying to read or write, and what you want to do with it, we can give you some better suggestions.

On ATmega32u4 based boards SerialUSB is now the same as Serial.

ARDUINO 1.6.7 - 2015.12.17
* Leonardo/Micro (and other atmega32u4 based boards) now have SerialUSB alias for Serial

On ATmega32u4 based boards SerialUSB is now the same as Serial.

Good to know. But now the Serial reference page is out of date, as it still mentions SerialUSB as being for SAM processors.

Thanks, ShapeShifter & oqibidipo…

So as far as my YUN goes these objects are functionally the same… ?!


There is just one object, Serial. SerialUSB is a macro that expands to Serial.