Is it about channel or so, I'm just not sure, but my android phone keeps losing wifi connection and immediately connect back continuously - therefore I can't transmit any data.
Here is my configuration :
sendCommand(F("AT+CWMODE=2")); //change mode and reset afterwards
sendCommand(F("AT+RST")); // reset module
String strCommand = F("AT+CIPAP=\"");
strCommand += AP_IP;
strCommand += F("\"");
sendCommand(strCommand);
strCommand = F("AT+CWSAP=\"");
strCommand += AP_SSID;
strCommand += F("\",\"");
strCommand += AP_PASSWORD;
strCommand += F("\",1,3"); //configure ap ssid and password
sendCommand(strCommand);
sendCommand(F("AT+CIFSR")); // get ip address
sendCommand(F("AT+CIPMUX=1")); // configure for multiple connections
sendCommand(F("AT+CIPSERVER=1,80")); // turn on server on port 80i
sendCommand(F("AT+CIPSTO=600")); //set timeout to 10 mins
And logic:
if (esp8266.available()) // check if the esp is sending a message
{
if (esp8266.find("+IPD,"))
{
delay(50);
int connectionId = esp8266.read() - 48;
Serial.println(connectionId);
}
}
Which channel should I use? Is it overlapping (I think channel 1,6,11 don't overlap).
PS: After resetting arduino, I can connect and transfer data with no issues. This happens when I reset eeprom and set up an AP again (from switching STA mode).