Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By paulfer
#54142 Hi Everyone!

I am going to try and explain this a best as I can.

I have made a sketch, that uses a 12e and has both AP and STA mode active.

Here is the code for the to call both mode's setup:
Code: Select all  doAPSetup();

  WiFi.mode(WIFI_AP_STA);

  doWifiSetup();


and here is the gyst of doAPSetup:
Code: Select alldelay(0);
  WiFi.softAP(ssid, "ednella1");
 
 
  IPAddress myIP = WiFi.softAPIP();
  Serial.print("AP IP:");
  Serial.println(myIP);
  server.on("/", HandleRootR);
  server.on("/qq", HandleRootQQ);
  server.on("/qs", HandleRootQS);
  server.on("/rst", HandleRootReset);
  server.on("/a1", HandleRootAon);
  server.on("/a0", HandleRootAoff);
  server.on("/r", HandleRootR);
  server.begin();
  Serial.println("AP start");


and doWifiSetup:
Code: Select allWiFi.begin(ssid, password);

  uint32_t lasttime = millis();
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(0);
    if (millis() - lasttime > 10000) //if there has been 10 seconds since we started trying-timeouot!
    {
      Serial.println("noWiFi");
      return;
    }
  }

  Serial.println("WiFi IP:");
  Serial.println(WiFi.localIP());


NOw, here is the ringer:

I have written and Android app, using Volley to send a GET request to the AP (the SKetch's AP) every 5 seconds. The skecth then responds with a value via HandleRoot, HandleRootA0n, etc.

Also, I send a GET request, every 2 minutes, via STA mode to my home's AP, (which may I call the ROUTER to avoid confusing you good sirs even more), via the internet to my website.

So, every 3 secs: ANDROID->AP->ANDROID
Every 2 mins: STA ->ROUTER->STA

All of this works just fine. HOWEVER, when I turn my home's ROUTER off, in other words, there is no internet access to the outside world. The sketch's AP mode simply stops answering any calls from the Android app. (With the exception of a sporadic correct burst every two or three minutes.)

To be more realistic, it runs the HandleRootAon function, but never sends the data back to the Android APP.

(For those of you who know Volley, it receives mostly NULL errors back as well as JAVA.eof.exceptions.)


The instant I turn my home's AP/ROUTER on again, the system works perfectly.

My questions is thus: Is there some sort of necessity for the STA mode to be connected to the internet for the AP mode to function?

In trying to debug this. I have disabled STA mode completely and only have AP mode, then the system works fine. Its only in DualMode this behaviour rears its head.

Regds

Paul