Hi,
I'm working on a router reseter ..
basically sends out 4 pings to two differnet IP addresses.
if either one returns I want a positive result.
If both fail I want a Negative result.
getting confussed with my "OR" and "AND".
Not sure how to tidy up my else.. as I need ELSE and two false pingRet , pingRet2.
cheers
david
delay(2000);
bool pingRet; // pingRet stores the ping() success (true/false)
bool pingRet2; // pingRet stores the ping() success (true/false)
#ifdef ledOut
startPing();
#endif
ICMPPing ping(pingSocket);
pingRet = ping(4, pingAddr, buffer);
pingRet2 = ping(4, pingAddr2, buffer);
Serial.println(buffer);
#ifdef ledOut
delay(250);
endPing();
delay(2000);
#endif
//
#ifdef ledOut
if(pingRet) // Failure I want to have an OR here so any Successful ping shows Network OK.
if(pingRet2) // Failure
{
pingSuccess();
lcd.clear();
lcd.setCursor(0,0);
lcd.print(" ping ok");
lcd.setCursor(0,1);
{
lcd.print(buffer);
delay(20);
{
}
}
}
else
{
// I need pingRet and pingRet2 to both be false here to generate this network fail.
pingFail();
lcd.clear();
lcd.setCursor(0,0);
lcd.print(" Network FAIL ");
delay(2000);
lcd.setCursor(0,0);
lcd.print(" Sarian Reset ");
delay(10000);
}
#endif
delay(delayMS);