Serial port over the board's USB connection; sketches use Serial.
More...
#include <SerialUSB.h>
|
| void | begin (unsigned long baud) override |
| | Does nothing: the port starts before setup().
|
| void | begin (unsigned long baud, uint16_t config) override |
| | Does nothing: the port starts before setup().
|
|
void | end () override |
| | Does nothing: the port stays up so the IDE can still upload.
|
| int | available () override |
| | Number of received bytes waiting to be read.
|
| int | peek () override |
| | Next received byte, left in the buffer.
|
| int | read () override |
| | Takes the next received byte from the buffer.
|
|
void | flush () override |
| | Sends any bytes still held in the USB buffer.
|
| size_t | write (uint8_t c) override |
| | Sends one byte.
|
| size_t | write (const uint8_t *buffer, size_t size) override |
| | Sends a block of bytes.
|
| | operator bool () override |
| | Whether a terminal has the port open.
|
Serial port over the board's USB connection; sketches use Serial.
The port is always running, so begin() and end() do nothing. Data written while no terminal has the port open is dropped.
◆ available()
| int SerialUSBClass::available |
( |
| ) |
|
|
override |
Number of received bytes waiting to be read.
- Returns
- Byte count.
◆ begin() [1/2]
| void SerialUSBClass::begin |
( |
unsigned long | baud | ) |
|
|
inlineoverride |
Does nothing: the port starts before setup().
- Parameters
-
| baud | Ignored; the baud rate means nothing over USB. |
◆ begin() [2/2]
| void SerialUSBClass::begin |
( |
unsigned long | baud, |
|
|
uint16_t | config ) |
|
inlineoverride |
Does nothing: the port starts before setup().
- Parameters
-
| baud | Ignored. |
| config | Ignored. |
◆ operator bool()
| SerialUSBClass::operator bool |
( |
| ) |
|
|
override |
Whether a terminal has the port open.
Use while (!Serial) {} in setup() to wait for the Serial Monitor.
- Returns
- true while a terminal has the port open (DTR set).
◆ peek()
| int SerialUSBClass::peek |
( |
| ) |
|
|
override |
Next received byte, left in the buffer.
- Returns
- 0-255, or -1 if nothing has been received.
◆ read()
| int SerialUSBClass::read |
( |
| ) |
|
|
override |
Takes the next received byte from the buffer.
- Returns
- 0-255, or -1 if nothing has been received.
◆ write() [1/2]
| size_t SerialUSBClass::write |
( |
const uint8_t * | buffer, |
|
|
size_t | size ) |
|
override |
Sends a block of bytes.
Waits while the USB buffer is full. Stops early if no terminal has the port open, or if the computer reads nothing for 0.5 s.
- Parameters
-
| buffer | Bytes to send. |
| size | Number of bytes. |
- Returns
- Number of bytes sent.
◆ write() [2/2]
| size_t SerialUSBClass::write |
( |
uint8_t | c | ) |
|
|
inlineoverride |
The documentation for this class was generated from the following file: