Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By Hack
#13974 Found this:
https://gist.github.com/igrr/3b66292cf8708770f76b

Looks like this is how we get access to the client object and do what I want to do:
Code: Select allvoid handle_image() {

  server.send(200, "image/png", "");

  WiFiClient client = server.client();

  client.write(image, sizeof(image));

}
User avatar
By gerardwr
#14255
taoyanren wrote:on WIFI_AP_STA mode, I can only access the station ip webserver but can not open AP ip webserver( http://192.168.4.1/) at the same time. Why?


You will have to choose which WiFi network you want to use to access the ESP, EITHER the network the Station is connected to, OR the ESP-AP-network the ESP can provide. So it is not possible to connect your browser device to the Station-IP AND the AP-IP at the same time.

To connect to ESP as AP you have to follow 2 steps:
1 - connect the Wifi of your browser device (smartphone or PC) to the AP that the ESP provides. Your browser device get an IP from the ESP in the 192.168.4.x range.
2 - when connected you can browse to 192.168.4.1
User avatar
By taoyanren
#14266
gerardwr wrote:
taoyanren wrote:on WIFI_AP_STA mode, I can only access the station ip webserver but can not open AP ip webserver( http://192.168.4.1/) at the same time. Why?


You will have to choose which WiFi network you want to use to access the ESP, EITHER the network the Station is connected to, OR the ESP-AP-network the ESP can provide. So it is not possible to connect your browser device to the Station-IP AND the AP-IP at the same time.

To connect to ESP as AP you have to follow 2 steps:
1 - connect the Wifi of your browser device (smartphone or PC) to the AP that the ESP provides. Your browser device get an IP from the ESP in the 192.168.4.x range.
2 - when connected you can browse to 192.168.4.1


I want my ESP to work as AP-STA mode.
ESP get ip(192.168.0.33) from my wireless router.
Smartphone get ip(192.168.4.101) from ESP.
PC get ip(192.168.0.22) from router.
Now, PC can browse 192.168.0.33 and works well, but smartphone can not browse 192.168.4.1.
And smartphone can ping 192.168.4.1.
When I use the offical esp firmware, AP and STA can be browsed at the same time. I think the wifi server library of ESP8266 Arduino is not same as offical code. :?: