LED indicator when Yun is connected to wifi

Hello, I was wondering how you guys would handle this. I have a Yun and would like to keep an external led lit while the Yun is connected to wifi. Even better may be if the Yun can successfully ping a certain object. The second it drops wifi or can not ping this object, the LED goes dark. Thank you

I would handle it this way: ping something every second. Better make it something local. If you get a response to the ping, switch the led on. No response, switch the led off.

Post your code.

With an ESP8266 you could e.g. use in loop()

if (WiFi.status() == WL_CONNECTED) digitalWrite(LED, HIGH);
else digitalWrite(LED, LOW);

Leo..