write(_:count:to:)

Writes an array of UInt8 to the specified slave device with the given address.

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

Parameters

data

An array of UInt8 to be sent to the slave device.

count

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

address

The address of the slave device to communicate with.

Returns

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