Closed seva-luchianov closed 1 year ago
I just tested your code with an ESP8266 and it works for me.
Do you get the response with a browser?
Call client.stop();
after the app.process(&client)
. Your wifi lib may need that. Some wifi libraries stop the client automatically in the destructor, some don't.
if (client.connected()) {
app.process(&client);
client.stop();
}
I just noticed that the ARDUINO UNO WiFi REV2 is the same board as MKR WiFi 1010 with a different form factor. Last time I checked the wifi client and server libraries for the board were garbage. I would seriously consider using some other development board.
I wasn't able to get a response from anything, browser or nodejs. I'll try calling client.stop()
as you mentioned! Do you have an suggestions for a specific development board? My only requirements are:
Wifi enabled
5v rail
2 pwm pins and 1 5v output pin
client.stop()
made this work as you said! Incredible how I've never seen that in any example code, even on Arduino's own website with examples specifically for the UNO Rev2. Really appreciate you helping out a newbie, hopefully someone else in the future can find this thread when they run into the same issue.
Nice that you got it working. With the 5V output requirement your choices are a lot more limited. Almost everything uses 3.3V nowadays. A logic level converter could be one option if you can't change your design otherwise.
If you like the library please give it star here on github.
I'm just trying to write the simplest ping command. Using nodeJS and axios to send data to the board:
And here is my arduino code (uno wifi rev 2)
Board connects to wifi, and for each ping sent it logs "pong" to serial out. But in nodeJS no response is ever received. I've tried everything I can think of
I've tried using
res.end();
andres.flush();
in any order, I've tried setting any and all headers with no success. I've tried sending bothget
andpost
using xhr from the browser as well. Ultimately I need this to work with a nodeJS backed but I'm open to any library that isn'taxios
if that's the issue... All examples on https://awot.net make it look like it just works. What am I doing wrong?