I am sending sensor data from one esp32 to another using the RNT code. I have two sending boards and one receiving board. One board keeps reporting an error sending the data. If I send a message every 10 seconds it does 5 messages and then reports an error sending the data. If I reset the sending esp32 the cycle repeats. I changed the interval to 1 minute and it now will send one message before starting to spit out errors. So it almost seems like this board is timing out or something???
The error message result is 12396.
Does anyone have any suggestions?
Thanks,
Dennis
Sara:
The code I’m using is from the RNT website:
// Send message via ESP-NOW
esp_err_t result = esp_now_send(broadcastAddress, (uint8_t *) &myData, sizeof(myData));
if (result == ESP_OK) {
Serial.println("Sent with success");
}
else {
Serial.println("Error sending the data");
}
It sends ok at first and then I get the message “Error sending the data”. I added a line to print the variable called result and it is 12396.
Thanks,
Dennis
That error number is not useful as it relies on ESP_ERR_WIFI_BASE of your particular ESP32. You have to use the constants provided by espnow.h.
According to the ESP-NOW documentation and the espnow.h file on GitHub you will need to figure out the actual error. You can use a switch statement or an if block to print the actual error. For example (You should be able to add the rest of the error messages here):
if(result == ESP_ERR_ESPNOW_NOT_INIT) {
Serial.println("ESPNOW is not initialized");
}
else if(result == ESP_ERR_ESPNOW_ARG) {Serial.println("invalid argument");
}
else if(blah, blah, blah
Ok, well it’s now started working. I moved the unit out to it’s permanent home, and it’s now on a different power supply, so maybe it was a power supply issue. Anyways, thanks for your help.