Reconnect Arduino WiFi Shield

Hello,

I have a problem with a WiFi Shield on an Arduino Uno.

In the location I want to put the system there are 4 networks. If one looses connectivity the shield should reconnect to other network.

I am posting on Google Docs information regarding some sensors every 10 minutes. If i cannot send 5 times the sensors, i will start a reconnecting cycle.

The problem is that if a reconnect cycle starts, even if i have the network up, the wi-fi doesnt connect to it.

My reconnect function is this:

void reconnect () {

WiFi.disconnect();
// status = WL_IDLE_STATUS;

delay(5000);

// if (status != WL_CONNECTED) {
status = WiFi.begin(ssid1, pass);
Serial.print("Attempting to connect to SSID: ");
Serial.println(ssid1);
delay(20000);
//}

if (status != WL_CONNECTED) {
status = WiFi.begin(ssid2, pass);
Serial.print("Attempting to connect to SSID: ");
Serial.println(ssid2);

delay(20000);
}

if (status != WL_CONNECTED) {
status = WiFi.begin(ssid3, pass);
Serial.print("Attempting to connect to SSID: ");
Serial.println(ssid3);

delay(20000);
}

if (status != WL_CONNECTED) {
status = WiFi.begin(ssid4, pass);
Serial.print("Attempting to connect to SSID: ");
Serial.println(ssid4);
failed =0;

delay(20000);
}

if (status == WL_CONNECTED) {

slcd.setCursor(0, 0);
slcd.print("Connected to");

slcd.setCursor(0,1);
slcd.print(WiFi.SSID());

failed =0;

delay (3000);

}
}

Hi,

How can it reconnect to the wrong network - do they have the same SSID as each other?

Geoff

No.

I have 4 SSID, with the same password. After some time the Wi-Fi doesn't connect to network. After 5 connection failed, i try to reconnect to the network.

The function above does that.

Ah sorry I misunderstood. The idea is that if it drops a connection it associates with the next SSID by design.

Any news or solutions to this problem?