ESP Now what is channel, can we use a static channel
Posted: Wed Mar 17, 2021 10:59 am
Hello, i have two questions:
Q1) I'm setting up ESP Now, i want to know can i put a specific channel number to Receiver node rather than it gets dynamically? for static channel number if i have to update some config on Wifi router i would go for it.
Q2) On sender node i want to understand what does below function is doing, what i understand in ESP Now protocol Sender node connects and sends data to Receiver node then why its looking for WiFi SSID
Q1) I'm setting up ESP Now, i want to know can i put a specific channel number to Receiver node rather than it gets dynamically? for static channel number if i have to update some config on Wifi router i would go for it.
Q2) On sender node i want to understand what does below function is doing, what i understand in ESP Now protocol Sender node connects and sends data to Receiver node then why its looking for WiFi SSID
Code: Select all
int32_t getWiFiChannel(const char *ssid) {
if (int32_t n = WiFi.scanNetworks()) {
for (uint8_t i=0; i<n; i++) {
if (!strcmp(ssid, WiFi.SSID(i).c_str())) {
return WiFi.channel(i);
}
}
}
return 0;
}