zero crossing detector?

the square wave generator has one LED. when power is present, it would bring the voltage to ground and no output

Right. The transistor pulls the output low during the positive phase. The pullup keeps it high during the negative phase.
Thanks.