identify when led connect to output pin

samuela:
I explain in first post ...

No you don't....

But what led disconnected? I thought you wanted to check the state (aka on or off) of a led on a panel? Not if it was disconnected...

So please post a schematic (a simple hand drawing will do) of how you connected it.