#include // Create a struct_message called myData struct_message recvRemoteData; // callback function that will be executed when data is received void OnDataRecv(uint8_t *mac, uint8_t *incomingData, uint8_t len) { Serial.println("received data"); String data = String((char *)incomingData); if (data.equals("flash")) { flash(); } } void handleRemoteSetup() { // Init ESP-NOW if (esp_now_init() != 0) { Serial.println("Error initializing ESP-NOW"); return; } // Once ESPNow is successfully Init, we will register for recv CB to // get recv packer info esp_now_set_self_role(ESP_NOW_ROLE_SLAVE); esp_now_register_recv_cb(OnDataRecv); }