I have an Arduino Pro mini 3.3V, 8 mHz and I want to use the pulsein() function for a low-going pulse. My question: Does the timer start when the function senses a LOW on the input pin, or when the function senses a high-to-low transition, or either?

Code snippet:

pinMode(3,INPUT); // Signal input to Arduino from pin 2 on LM339  - D3
int pwindow = 6000; // Maximum timeout value for pulsewidth
long pcounterA = 0; // Unfiltered Pulse Width of Channel 1
pcounterA = pulseIn(3,LOW,pwindow);

Thanks for any help. JT

  • 1
    Slight nitpick: mHz is millihertz; MHz is megahertz. That's a difference of 9 orders of magnitude.
    – AaronD
    Apr 2, 2018 at 23:06

1 Answer 1


According the official Arduino Reference: PulseIn


Reads a pulse (either HIGH or LOW) on a pin. For example, if value is HIGH, pulseIn() waits for the pin to go HIGH, starts timing, then waits for the pin to go LOW and stops timing. Returns the length of the pulse in microseconds. Gives up and returns 0 if no pulse starts within a specified time out.

  • 2
    Further, from that same page, **Please also note that if the pin is already high when the function is called, it will wait for the pin to go LOW and then HIGH before it starts counting. ** Apr 2, 2018 at 19:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.