Reads data from SPI port and returns it as a series of bytes
Device
Name | Type | Description |
---|---|---|
numberOfBytes | Integer |
How many bytes to read in from the bus
|
Blob — the bytes read from the SPI bus
This method reads a specified quantity of data from the target SPI bus and returns it as a Squirrel blob. If the SPI is configured for full duplex operation, the same number of zero bytes will be automatically clocked out of COPI (controller out, peripheral in).
COPI was previously referred to as MOSI.
The code below provides a very basic example of interacting with an SPI device, initially by reading in eight bytes of data into a blob using spi.readblob().