Please help me understand this behavior

If developing a cnc torch height controller is a relatively simple task then I am afraid to see what a complex task would like. sorry, I'm not blinking an LED.