analogWrite() question

Learning:
Amorri, the "if" statement is performing your analog write function ONLY when the compare == (is equal to 0). As soon as the compare is NOT equal to 0 (it's pretty quick), the if statement returns FALSE. Probably why your analogWrite stops.

I think you may have misunderstood what analogWrite() does. Once started, the output will continue until it is explicitly stopped by another write operation on that pin.