Arduino + WIFly (check the connection status)

Hello.

My project it’s running with Arduino + WiFly very good…

But…i check the stabilty of the system shuting dowm the router, and the problem it’s that the Wifly doesn`t know that it’s not really connected to internet and try to send the datas to the server.

My question it’s , how can i check if Wifly it’s really conected to internet and if not make a WiFly begin () , or similar to retry the lost connection ?

I try comparing the WiFly IP, but didn’t work because when WiFly has an IP if lost the connectivity the IP it’s the same, is not 0.0.0.0…

Thanks!!!

I am using the SPIUARTTERMINAL code to test to see if the SPI-Uart Bridge is working properly. Using the code, the code stops at “Attempting to connect to SPI UART…” Besides pin connections of the SPI-UART Bridge connected to the Arduino (particularly I am using the Mega) that could be a problem, what is a potential problem that prevents the code to go through? For easy access here is the code:

void setup() {

Serial.begin(9600);

Serial.println(“SPI UART on WiFly Shield terminal tool”);

Serial.println(“--------------------------------------”);

Serial.println();

Serial.println(“This is a tool to help you troubleshoot problems with the WiFly shield.”);

Serial.println(“For consistent results unplug & replug power to your Arduino and WiFly shield.”);

Serial.println(“(Ensure the serial monitor is not open when you remove power.)”);

Serial.println();

Serial.println(“Attempting to connect to SPI UART…”);

SpiSerial.begin(9600);

Serial.println(“Connected to SPI UART.”);

Serial.println();

Serial.println(" * Use $$$ (with no line ending) to enter WiFly command mode. ("CMD")");

Serial.println(" * Then send each command followed by a carriage return.");

Serial.println();

Serial.println(“Waiting for input.”);

Serial.println();

}

void loop() {

// Terminal routine

// Always display a response uninterrupted by typing

// but note that this makes the terminal unresponsive

// while a response is being received.

while(SpiSerial.available() > 0) {

Serial.print(SpiSerial.read(), BYTE);

}

if(Serial.available()) { // Outgoing data

SpiSerial.print(Serial.read(), BYTE);

}

}