write(_:count:)

Writes a series of bytes to the external device through the serial connection.

UART.swift:242
@discardableResult func write(_ data: [UInt8], count: Int? = nil) -> Result<(), Errno>

Parameters

data

An array of UInt8 to be sent to the device.

count

The number of bytes in data to be sent. Make sure it doesn’t exceed the length of the data. If it’s nil, all data will be sent.

Returns

Whether the communication succeeds. If not, it returns the specific error.