detect both positive and negative pulses