|
|
|
# Esp Now Basic Steps
|
|
|
|
|
|
|
|
- Define Mac address of receiving esp32
|
|
|
|
- create a ```esp_now_peer_info_t```
|
|
|
|
- define a function for sending/receiving
|
|
|
|
|
|
|
|
```
|
|
|
|
setup(){
|
|
|
|
Serial.begin(115200);
|
|
|
|
while(!Serial); //open serial connection and wait
|
|
|
|
WiFi.mode(WIFI_STA); //enable wifi and set it to the correct mode
|
|
|
|
esp_now_init();
|
|
|
|
esp_now_register_send_cb(onDataSent);
|
|
|
|
esp_now_register_recv_cb(onDataRecv);
|
|
|
|
// fill out your esp_now_peer_info_t
|
|
|
|
esp_now_add_peer(peerInfo);
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
- Now you can send in your ```loop()```, or leave ```loop()``` empty to only receive |
|
|
\ No newline at end of file |