Last active
May 20, 2024 19:24
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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