Im using an ethernet shield, and if it fails to obtain a local LAN Ip, I want to stop the loop from running.. can I do this?
so In void setup I have this line..
if (Ethernet.begin(mac) == 0) {
{ Serial.println("Failed to configure Ethernet using DHCP");
lcd.setCursor(0,0);
lcd.print("LAN FAILURE !");
delay(1000);}
/// I want this to stop the loop from running from here . HOW?
do I create a else comment in loop and do nothing if (Ethernet.begin(mac) == 0)
{ Serial.println("Failed to configure Ethernet using DHCP");
lcd.setCursor(0,0);
lcd.print("LAN FAILURE !");
delay(1000);}
/// I want this to stop the loop from running from here . HOW?
Use exit();
And indent better.
if (Ethernet.begin (mac) == 0)
{
Serial.println ("Failed to configure Ethernet using DHCP");
lcd.setCursor (0,0);
lcd.print ("LAN FAILURE !");
delay (1000);
exit (1); // give up
}
Don't be shy to hit the space bar. You don't get charged extra for spaces.