Power / USB aware serial port class, that uses only the USB UART.

THis is the implementation of communication via USBUART. It builds upon mbed’s mbed::Serial class. Because mbed ti not aware of changes power in power and charging states, this class acts as a wrapper around the mbed::Serial class.


This Serial class will communicate with the USBUART only when the USB power is connected. All data consumed by the class, then the USB power is absent, is ignored.

To see how you use the Serial port, please refer to the mbed documentation

Public Functions


Create a new instance of the USB UART port.

This is the only available contructor, because the RX and TX lines are hardwired. Ideally you should not initialize your own USB serial port, but use the systems default I/O streams.

bool Serial::DTR()

See the status for the Data Terminal Ready signal.

true if DTR is set

bool Serial::IsReady()

Test if the USB is connected (powered) and mounted CDC device is a CDC device by the host.

Before any data can be sent via the USB Serial link, the host (computer) must have emunerated Mono as a USB CDC device. ALso, to ensure the USB cable is connected, the USB power is monitored. These two conditions must be met, before this method returns true.

true if USB power is on and USB is enumerated on host