I'm none of those so here goes.
Code reads a (green) Led pin as if an antenna picking up stray garbage looking for a trigger, and if we get one then code does some PinMode shuffling, say pulling one...