I’m trying to create a webserver with esp8266 . I followed all the the instruction showed here
lastminuteengineers.com/creating-esp8266-web-server-arduino-ide/
Both in AP mode and STA mode my pc browser(I tried with firefox, chrome and edge) can not connect with webserver. What’s the wrong ?
Hi.
I don’t know. I haven’t tried that example.
That tutorial is not from our blog.
Do you get any errors?
Regards,
Sara
Perhaps try the Random Nerd Tutorials ESP32/ESP8266 Web Server: Control Outputs with Momentary Switch
Could this be the issue:
Your router may be on the same ip address (192.168.1.1). This can be verified by opening a Windows command prompt; then enter ipconfig. If your gatway is 192.168.1.1 then router is on same ip address. Change 192.168.1.1 in your sketch to 192.168.1.X; X being any number that is not used already in use for one of your devices.
The sketch; IPAddress local_ip needs to be on same network. For example if your pc gateway is 10.0.0.1 then it is not on the same network as 192.168.1.1; with this case try changing sketch network settings:
IPAddress
local_ip 10.0.0.X X being any number that is not used already in use.
IPAddress
gateway 10.0.0.1
IPAddress
subnet 255.255.255.0
William
Yes. All IP Addresses in the same network must be unique. You have 252 to choose from (0 is already used and 255 is generally the broadcast address). Your router will take 1 as well. Take a look at your router’s administration page and see what IP Addresses have been set for DHCP. Pick an address outside that range that’s not already in use. For example, my network is 192.168.2.0; My router uses 192.168.2.1 and its DHCP range is from 100 to 150. So, for the first of my ESP32’s use 192.168.2.200 and work my way up for others (201, 202 etc).
As I recall though, most of the sketches don’t use static IP addresses and instead gt the router to provide one using DHCP.
To be working with and programming a network device you should really understand what you are working with. Take a look at this tutorial.