mirror of
https://github.com/0xFEEDC0DE64/arduino-esp32.git
synced 2025-07-29 10:17:15 +02:00
Added ESPNow Multi-Slave example (#669)
* Added ESPNow basic example * fixed meta doc for slave * refactored folder structure * bug fixes * Added Single Master Multi-Slave * updated meta docs
This commit is contained in:
committed by
Me No Dev
parent
2b6d47ac17
commit
a66b544d18
@ -55,7 +55,10 @@ void InitESPNow() {
|
||||
// Scan for slaves in AP mode
|
||||
void ScanForSlave() {
|
||||
int8_t scanResults = WiFi.scanNetworks();
|
||||
// reset on each scan
|
||||
bool slaveFound = 0;
|
||||
memset(&slave, 0, sizeof(slave));
|
||||
|
||||
Serial.println("");
|
||||
if (scanResults == 0) {
|
||||
Serial.println("No WiFi devices in AP Mode found");
|
||||
@ -128,14 +131,6 @@ bool manageSlave() {
|
||||
// Slave already paired.
|
||||
Serial.println("Already Paired");
|
||||
return true;
|
||||
} else if (exists == ESP_ERR_ESPNOW_NOT_INIT) {
|
||||
// How did we get so far!!
|
||||
Serial.println("ESPNOW Not InitESP_ERR_ESPNOW_NOT_INIT");
|
||||
return false;
|
||||
} else if (exists == ESP_ERR_ESPNOW_ARG) {
|
||||
// Invalid Argument
|
||||
Serial.println("Invalid Argument");
|
||||
return false;
|
||||
} else {
|
||||
// Slave not paired, attempt pair
|
||||
esp_err_t addStatus = esp_now_add_peer(peer);
|
||||
@ -191,8 +186,6 @@ void deletePeer() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
uint8_t data = 0;
|
||||
// send data
|
||||
void sendData() {
|
||||
|
Reference in New Issue
Block a user