Before the communication connection is established, the need to burn the following code to the Arduino UNO,
#include
# define SS 10
Void setup (void) {
Serial.begin(115200);//set the baud rate to 115200 for usart
DigitalWrite (SS, HIGH);//disable the Slave Select
SPI. The begin ();
}
Void loop (void) {
char c;
DigitalWrite (SS, LOW);//enable Slave Select
//send the test string
For (const char * p="Hello, world! \ r "; C=* p; P++) {
SPI. Transfer (c);
Serial. Print (c);
}
Serial. Println ();
DigitalWrite (SS, HIGH);//disable the Slave Select
D
Arduino UNO will be shown in the figure below connection and RTL8722 connection, we use the first "0" group of SPI as from machine, and the Arduino UNO as SPI host
MicroPython then copy the following code and paste paste mode to REPL window, and wait for the code to take effect,
From the machine import SPI
S1=SPI (0, mode=SPI SLAVE)
For I in range (14) :
CRH (s1. The read ())