[RESOLVED] Setting StaticIP Error: statement cannot resolve address of overloaded function


#1

I am trying to set a staticIP on my Photon. Trying to communicate with a Python TCP Client and using my Photon as a TCP Server.

The error I keep running into is:
“error: statement cannot resolve address of overloaded function
IPAddress myAddress(##,##,##,##)”

RAW Form:
/workspace//src/tcp_wifi.cpp: In function ‘void setup()’:
/workspace//src/tcp_wifi.cpp:25:21: error: statement cannot resolve address of overloaded function
IPAddress myAddress(##, ##, ##, ##);
^

What am I doing wrong?


#2

We’d need to see your code that produces that error too.


#3
void setup() {
    WiFi.clearCredentials();
    WiFi.off();
    IPAddress myAddress(12,86,213,18);
    IPAddress netmask(255,255,255,0);
    IPAddress gateway(12,86,213,1);
    IPAddress dns(12,86,213,1);
    WiFi.setStaticIP(myAddress, netmask, gateway, dns);
    WiFi.useStaticIP;
    WiFi.on();
    WiFi.connect();
    //sprintf(myIpAddress, "%d.%d.%d.%d", myIp[0], myIp[1], myIp[2], myIp[3]);
    Particle.publish("IP set");
    //delay(1000);
    server.begin();
}

#4

If you look at the line number provided in the error message and not at the code excerpt IPAddress myAddress(##,##,##,##) you’ll notice that the actual problem is this line

  WiFi.useStaticIP;

this should be

  WiFi.useStaticIP();

BTW, to do anything with the WiFi module it needs to be powered, so WiFi.on() should be called before WiFi.setStaticIP()


#5

Holy cow, that’s embarrassing.

Thank you and I appreciate the tip.


#6

Thanks for the help @ScruffR!