Loop with condition

im not sure with the signals im taking from machine, as far as i know its a 5v signal