I am having trouble with the pulseIn function. I did a google search on it and it appears many people have issues with it. I'm wondering if it's defective in any way?
Anyways, I'm using this function to calculate the duration a pulse is high. I began using the example code below from this website. The only change I made is added an output high to trigger the pulse. I then jumpered the output to pin 7 for about 1 second. No pulse was read. I only get 0 in the serial monitor. Anyone have any idea on how to get this function to work properly? I added timeouts of 5 seconds with no luck. Any help/insight will be appreciated.
int pin = 7;
unsigned long duration;
duration = pulseIn(pin, HIGH);