How to control esp2866 using other wifi connection

/*Define static IP*/
IPAddress local_IP (192, 168, x, x);
IPAddress gateway (192, 168, 1, 1);
IPAddress subnet(255, 255, 255, 0);

void setup()
{ 
  if (!WiFi.config(local_IP, gateway, subnet)) {
  Serial.println("STA Failed to configure");
}
  Serial.begin(115200);
  connectWiFi();
  server.begin();
}

I tried to use other Wifi connection to control my esp but it didn't work I also have tried to create static IP address as you can see the code above but it didn't work. I don't know what exactly do you call this but I just want to control my esp using my mobile app that I created even i'm connected in other WiFi conenction or mobile data how could I possibly achieve that? TIA

That cannot possibly be all your code.

If it is then you will need to write some code in your loop(0 function that does the things you want done.

1 Like

well yeah that's all I got for the meantime I just thought static IP would solve my problem I'm still gathering infos