Skip to content

Instantly share code, notes, and snippets.

@Fire7ly
Last active May 20, 2024 19:24
Show Gist options
  • Save Fire7ly/dd87ac7d0abe462d5323e6ca42ee5f33 to your computer and use it in GitHub Desktop.
Save Fire7ly/dd87ac7d0abe462d5323e6ca42ee5f33 to your computer and use it in GitHub Desktop.
ESPNOW_ESP32 Receiver Example from https://www.youtube.com/watch?v=Ydi0M3Xd_vs
#include <esp_now.h>
#include <WiFi.h>
#define CHANNEL 1
uint8_t newData;
void setup()
{
Serial.begin(115200);
WiFi.mode(WIFI_AP);
WiFi.softAP("RX_1", "RX_1_Password", CHANNEL, 0);
esp_now_init();
esp_now_register_recv_cb(OnDataRecv);
}
void loop(){
Serial.print("I did this to data -> ");
Serial.println(newData * 5);
delay(3000);
}
/** callback when data is recv from Master **/
void OnDataRecv(const uint8_t *mac_addr, const uint8_t *data, int data_len)
{
Serial.print("I just received -> ");
Serial.println(*data);
memcpy(&newData, data, sizeof(newData));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment