I'm using Esptouch for smart config WiFi on Esp8266. I did change IP to static IP but I didn't connect. So Does anyone have any ideas to help me? Sorry my English is not good
const IPAddress& demo = WiFi.localIP();
//setup getway
int gateway0 = int(demo[0]);
int gateway1 = int(demo[1]);
int gateway2 = int(demo[2]);
int gateway3 = 1;
IPAddress gateway(gateway0,gateway1,gateway2,gateway3);
//setup ip
IPAddress ip(gateway0, gateway1, gateway2, 233);
//setup subnet
IPAddress subnet(255, 255, 255, 0);
WiFi.config(ip,gateway,subnet);
Serial.println("");
Serial.println("WiFi connected");
Serial.println(WiFi.localIP());
Do you want to change the local IP when your ESP is in AP_STA (or AP) mode.
If yes, add this to your code:
IPAddress local_IP(192, 168, 10,11);
IPAddress gateway(192, 168, 4, 9);
IPAddress subnet(255, 255, 255, 0);
WiFi.softAPConfig(local_IP, gateway, subnet);
WiFi.softAP(ssid, password);`//change the SSID and password
You can change the values, local_IP is what you'll get if you execute WiFi.localIP().