Hello, I am using an ESP32 with ESPNOW and it is getting warm to the touch. Is this heat okay for the ESP32 over a long period of time? Here is my code:
ESP32 #1 Code:
#include <Arduino.h>
#include <WiFi.h>
#include <esp_now.h>
uint8_t addressESP2[] = {0xEC, 0x94, 0xCB, 0x4C, 0x76, 0x18};
typedef struct TxStruct
{
int touchOut;
} TxStruct;
TxStruct sentData;
void OnDataSent(const uint8_t *mac_addr, esp_now_send_status_t status)
{
Serial.print("\r\nLast Packet Send Status:\t");
Serial.println(status == ESP_NOW_SEND_SUCCESS ? "Delivery Success" : "Delivery Fail");
}
void setup()
{
Serial.begin(115200);
WiFi.mode(WIFI_STA);
if (esp_now_init() != ESP_OK)
{
Serial.println("Error initializing ESP-NOW");
return;
}
esp_now_register_send_cb(OnDataSent);
esp_now_peer_info_t peerInfo;
memcpy(peerInfo.peer_addr, addressB2, 6);
peerInfo.channel = 0;
peerInfo.encrypt = false;
if(esp_now_add_peer(&peerInfo) != ESP_OK)
{
Serial.println("Failed to add peer");
return;
}
}
void loop()
{
int result;
int touchP = touchRead(15);
if(touchP < 80) { result = 1; }
else { result = 0; }
esp_now_send(addressB2, (uint8_t *) &result, sizeof(result));
delay(25);
}
ESP32 #2 Code:
#include <Arduino.h>
#include <WiFi.h>
#include <esp_now.h>
uint8_t addressESP1[] = {0xEC, 0x94, 0xCB, 0x4C, 0xB2, 0xF0};
typedef struct RxStruct
{
int touchIn;
} RxStruct;
RxStruct receivedData;
void OnDataRecv(const uint8_t * mac, const uint8_t *incomingData, int len)
{
memcpy(&receivedData, incomingData, sizeof(receivedData));
}
void setup()
{
Serial.begin(115200);
WiFi.mode(WIFI_STA);
if (esp_now_init() != ESP_OK)
{
Serial.println("Error initializing ESP-NOW");
return;
}
esp_now_register_recv_cb(OnDataRecv);
esp_now_peer_info_t peerInfo;
memcpy(peerInfo.peer_addr, addressB1, 6);
peerInfo.channel = 0;
peerInfo.encrypt = false;
if(esp_now_add_peer(&peerInfo) != ESP_OK)
{
Serial.println("Failed to add peer");
return;
}
pinMode(2, OUTPUT);
}
void loop()
{
if(receivedData.touchIn == 1) { Serial.println("Touched"); digitalWrite(2, HIGH); }
else { Serial.println("Not Touched"); digitalWrite(2, LOW); }
}
These ESP32's are going to be controlling some LEDs. One ESP32 will be the remote and the other will control the LEDs. The remote ESP32 I can put into deep-sleep and wake up with its touch pins, but the other ESP32 that is controlling the leds can't be put into deep-sleep because it is controlling the leds, it also needs to always be ready to receive data from the remote ESP32. Thanks.