56 lines
1.7 KiB
Markdown
56 lines
1.7 KiB
Markdown
|
# Peer-to-peer Example
|
||
|
One-way communication for transmission or reception.
|
||
|
|
||
|
# Configuration
|
||
|
|
||
|

|
||
|
|
||
|

|
||
|
|
||
|
# Parameter Setting
|
||
|
The following parameters must match on the sender and receiver.
|
||
|
|
||
|
## Payload size & channel
|
||
|
```
|
||
|
uint8_t payload = 32;
|
||
|
uint8_t channel = CONFIG_RADIO_CHANNEL;
|
||
|
```
|
||
|
|
||
|
## Sender side
|
||
|
```
|
||
|
// Set destination address using 5 characters
|
||
|
esp_err_t ret = Nrf24_setTADDR(&dev, (uint8_t *)"FGHIJ");
|
||
|
```
|
||
|
|
||
|
## Receiver side
|
||
|
```
|
||
|
// Set my own address using 5 characters
|
||
|
esp_err_t ret = Nrf24_setRADDR(&dev, (uint8_t *)"FGHIJ");
|
||
|
```
|
||
|
|
||
|
# nRF24L01 Address Register Setting
|
||
|
|Sender||||Receiver||||
|
||
|
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
|
||
|
|TX_ADDR<br>"FGHIJ"|RX_ADDR_P0<br>"FGHIJ"|RX_ADDR_P1<br>NONE||TX_ADDR<br>NONE|RX_ADDR_P0<br>NONE|RX_ADDR_P1<br>"FGHIJ"||
|
||
|
|(Send Data)|->|->|->|->|->|(Get Data)|Data to Receiver|
|
||
|
||(Get Ack)|<-|<-|<-|<-|(Send Ack)|Ack to Sender|
|
||
|
|
||
|
# Setting Register
|
||
|
The underlined address match on the sending and receiving sides.
|
||
|
No other addresses are used.
|
||
|
|
||
|
### Sender Register
|
||
|

|
||
|
|
||
|
### Receiver Register
|
||
|

|
||
|
|
||
|
# Screen Shot
|
||
|

|
||
|
|
||
|
|
||
|
# Communicat with Arduino Environment
|
||
|
Run this sketch.
|
||
|
ArduinoCode\Peer-to-peer\StringTest
|
||
|
|