ESP-NOW is a short-range, low-power communication protocol that enables multiple devices to communicate with each other with or without Wi-Fi. This protocol is similar to the low-power 2.4GHz wireless connection commonly found in wireless mice - devices are paired before they can communicate. Once paired, the connection between devices is continuous, point-to-point, and does not require a handshake protocol.
init set channel data type
Initialises the data type of a channel.
Add peer id ifidx encrypt
Add the specified mac address and set it as id.
set AP mode ssid password
Set the pairing key.
send id data
Sends data to a channel.
broadcase send data
Broadcast sending data.
set primary master key
Set the master key.
get mac address mode
Sets the form through which the MAC address is obtained.
get remote ssid
Get the wifi name of the remote MAC host.
get remote ssid
Sets the form through which the MAC address is obtained.
receive callback
Get the MAC and data for the callback function.
after send callback flag
Set the flag bit after the send callback function and perform data processing.
Display local mac address, received data, wifi name, remote host mac address and sent data on the screen.
Note: the name of the created variable is not allowed to be the same as the name of the formal parameter, i.e., you are not allowed to use the variable with the name "addr", "data" as the data fetch.
Local mac address, received data, wifi name, remote host mac address and sent data are displayed on the screen. Set the key send and stop function.
Note: the name of the created variable is not allowed to be the same as the name of the formal parameter, i.e. it is not allowed to use the variable with the name "flag" as the data fetch.
Finish editing the programme, run the programme of receiver and transmitter respectively, then we can realize the ESP-NOW short-range wireless communication.