WiFi

setStaticIP()

WiFi.setStaticIP, setStaticIP

Defines the static IP addresses used by the system to connect to the network when static IP is activated.

Static IP addressing is only available on the Photon and P1 (Gen 2). It is not available on the Argon or Ethernet (Gen 3).

// SYNTAX

void setup() {
    IPAddress myAddress(192,168,1,100);
    IPAddress netmask(255,255,255,0);
    IPAddress gateway(192,168,1,1);
    IPAddress dns(192,168,1,1);
    WiFi.setStaticIP(myAddress, netmask, gateway, dns);

    // now let's use the configured IP
    WiFi.useStaticIP();
}

The addresses are stored persistently so that they are available in all subsequent application and also in safe mode.