SPI - Read and Write Data

Materials

  • AmebaD [ AMB23 / AMB21 / AMB22 / BW16 / BW16-TypeC ] x 1
  • Arduino UNO x 1

Example

SPI is a fast and robust communication protocol that are commonly found on many microcontrollers and is often used to retrieve sensor data or output image signal to a display.

Code

Then copy and paste the following code line by line into REPL to see their effects.

from machine import SPI
spi = SPI(1)          # Only support 2 sets of SPI -- 0 and 1, for connection please refer to the table below
spi.write(bytes([123]))     # Write number 123 
spi.read(8)
Please confirm that QQ communication software is installed