User Tools

Site Tools


esp8266:esp8266-setting-static-ip

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
esp8266:esp8266-setting-static-ip [2019/10/11 02:53]
Ilias Iliopoulos [WiFi persistence and auto-connection]
esp8266:esp8266-setting-static-ip [2019/10/11 02:54]
Ilias Iliopoulos Changed title
Line 98: Line 98:
 Make sure that the IP addresses provided to ''​WiFi.config()''​ are proper IP addresses. In my experiments,​ it happened that instead of a gateway IP address, the code submitted the subnet mask 255.255.255.0. This is considered as an error by ''​WiFi.config()''​ and if the function is not inserted in the error-checking loop shown above, the ESP8266 will activate the DHCP client and you will try desperately to figure out what has happened!!! Make sure that the IP addresses provided to ''​WiFi.config()''​ are proper IP addresses. In my experiments,​ it happened that instead of a gateway IP address, the code submitted the subnet mask 255.255.255.0. This is considered as an error by ''​WiFi.config()''​ and if the function is not inserted in the error-checking loop shown above, the ESP8266 will activate the DHCP client and you will try desperately to figure out what has happened!!!
  
-===== Final connectWiFi() function =====+===== Example ​connectWiFi() function =====
 <​code>​ <​code>​
  
Line 123: Line 123:
   WiFi.persistent(false);​   WiFi.persistent(false);​
   WiFi.setAutoConnect(false);​   WiFi.setAutoConnect(false);​
 +  WiFi.setAutoReconnect(false);​
  
   while (!WiFi.config(staticIP,​ gateway, subnetMask)) {   while (!WiFi.config(staticIP,​ gateway, subnetMask)) {
esp8266/esp8266-setting-static-ip.txt ยท Last modified: 2024/02/02 21:49 by Ilias Iliopoulos