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:
Arvind Ravulavaru
2017-09-27 14:16:17 +05:30
committed by Me No Dev
parent 2b6d47ac17
commit a66b544d18
3 changed files with 341 additions and 10 deletions

View File

@ -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() {