pros::Serial class

Base classes

class Device

Constructors, destructors, conversion operators

Serial(std::uint8_t port, std::int32_t baudrate) explicit
Creates a Serial object for the given port and specifications.
Serial(std::uint8_t port) explicit
Creates a Serial object for the given port without a set baudrate.

Public functions

std::int32_t set_baudrate(std::int32_t baudrate) const virtual
Serial communication functions
std::int32_t flush() const virtual
Clears the internal input and output FIFO buffers.
std::int32_t get_read_avail() const virtual
Returns the number of bytes available to be read in the the port's FIFO input buffer.
std::int32_t get_write_free() const virtual
Returns the number of bytes free in the port's FIFO output buffer.
std::int32_t peek_byte() const virtual
Reads the next byte avaliable in the port's input buffer without removing it.
std::int32_t read_byte() const virtual
Reads the next byte avaliable in the port's input buffer.
std::int32_t read(std::uint8_t* buffer, std::int32_t length) const virtual
Reads up to the next length bytes from the port's input buffer and places them in the user supplied buffer.
std::int32_t write_byte(std::uint8_t buffer) const virtual
Write the given byte to the port's output buffer.
std::int32_t write(std::uint8_t* buffer, std::int32_t length) const virtual
Writes up to length bytes from the user supplied buffer to the port's output buffer.