m1cr0lab-esp32 / esp-now-network-and-wifi-gateway Goto Github PK
View Code? Open in Web Editor NEWESP-NOW network + WiFi gateway to the Internet
License: MIT License
ESP-NOW network + WiFi gateway to the Internet
License: MIT License
The following line of code seems to not be working anymore:
peerInfo.ifidx = ESP_IF_WIFI_STA;
I get the following error
In file included from sketch\ESP_NOW_2.ino.cpp:1:0:
C:\Users\..\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.7\cores\esp32/Arduino.h:194:12: error: 'std::round' has not been declared
using std::round;
^
C:\Users\..\..\Documents\Arduino\..\ESP_NOW_2\ESP_NOW_2.ino: In function 'void initEspNow()':
ESP_NOW_2:139:20: error: cannot convert 'esp_interface_t' to 'wifi_interface_t' in assignment
peerInfo.ifidx = ESP_IF_WIFI_STA;
^
Multiple libraries were found for "WiFi.h"
Used: C:\Users\..\..\..\Arduino15\packages\esp32\hardware\esp32\2.0.7\libraries\WiFi
Not used: D:\Program Files\Arduino\libraries\WiFi
exit status 1
cannot convert 'esp_interface_t' to 'wifi_interface_t' in assignment
If you send a successful HTTP request to a server before receiving data from the sender, in the setup function for instance, it will work fine and you'll get a 200 code.
However, if you add a line in the onReceive() function of the receiver that sends the same HTTP request using your WiFi network (whenever you receive data from the esp32 sender using the same WiFi channel), it will always give you a -1 error code.
Here is an example where the first POST request is sent in setup(), and the two other POST requests are sent in onReceive() function, after receiving data two times :
Sender (does not appear on the image)
Receiver: 192.168.188.120
Server: 192.168.188.230
As you can see, the first POST request works fine (frames 105 to 120). Meanwhile, in the two last POST requests the receiver sends [RST, ACK] and does not proceed with sending payload, regardless of how the server is coded. Here is the code I used for receiver and sender:
You can reproduce this issue using the following files:
The code tries to send a GET request to api.github.com before receiving data and every time it receives data in the callback function. Here is the result:
Note: I had to comment this line peerInfo.ifidx = ESP_IF_WIFI_STA;
because it would not compile using Arduino.
Never used ESP-NOW before.... Is there a reason this will not work in the opposite direction? I need the sender to be the gateway, broadcasting to a number of receivers every few seconds.
I have modified the code to have the sender be gateway and the receivers pair themselves to it as peers. Both sender and receiver(s) report correct initialization and pairing (receivers) but the receivers never receive a msg. I tried a broadcast send AND specific MAC address with no difference. Happy to contribute my code if this is possible and I can get it to work.
Hey all,
I can confirm that you have to use the same WiFi-Channel for ESPNow-Sender and ESPNow-to-WiFi-Gateways. If you have multiple routers with the same SSID (e.g. in university or company) and you always want to use the best WiFi (so no hardcoded channel) you have to try to send the message on each channel until you get a success reply.
`
channel = 1
send = false;
while(!send){
send = sendOnChannel(channel);
if(send){
break;
}else{
channel = channel % 13 + 1;
}
}
`
I was able to connect to my network, but I can't send anything using internet.
I'm using a socket connection, but everytime I call it, I get an error...
The code is the same as the repository, except for the socket connection...
Does anybody had any problems like this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.