Go Down

Topic: Retry 10 sec later if network fail to connect to router (Read 562 times) previous topic - next topic

smallpoul

Sorry if this question have already been ask but i didn't find the awnser. The problem is that if we lost the electricity, the router take more time to boot then the arduino so it fail to make a connection and i need to do a manual reset for it. Is therr a way or a command to reset the arduino if network fail to initialyse?

Thanks in advance
Mike

PeterH

Better to check for successful initialisation and retry until it succeeds.
I only provide help via the forum - please do not contact me for private consultancy.

PaulS

How to test for successful connection depends on whether you are using an Ethernet shield or a WiFi shield.

smallpoul

I use the ethernetshiel. I use the
Code: [Select]
ethernet.begin(mac, ip); in the void setup. And i use
Code: [Select]
if(ethernet.begin(mac) == o) could i put there a reset sketche and if so, how to??

Thanks

UKHeliBob

No need to reset the Arduino.  If the connection fails just keep trying until it succeeds as has been suggested.
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

smallpoul

I know what you mean but it's in the void setup, how could you loop it in the void setup? Could i initialise the ethernet from the void loop??

UKHeliBob

Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

PaulS

Quote
how could you loop it in the void setup?

Just like you would "loop it" in the loop() function.

Code: [Select]
while(Ethernet.begin(mac, IP) == 0)
{
   // do nothing
}

Go Up