pulseIn error

hello every one
i just want to measure the high of the pulse
but when i use pulseIn it returns only zero bu when i connect the output of my circuit to digital oscilloscope it shows what it is
the frequency of my pulse is about 20 micro second and higher
does anybody here can help me with this function or any other function???

int senserpin=8;

float duration;

void setup() 

void loop()
 duration = pulseIn(senserpin,HIGH);

} :confused:

pulseIn.ino (202 Bytes)

i just want to measure the high of the pulse

It doesn't make sens to me :o

You want to measure the width ?

For an accurate measurement, I suggest an input capture, or an attachinterrupt(change), or a blocking code by reading the pin of interest with PIO_PDSR. Search in the DUE sub forum for example sketches.

Hi there @hatam_mn,

Have a look to library tc_lib available at GitHub - antodom/tc_lib: This is a library to take advantage of different functionalities available on Timer Counter (TC) modules in Arduino Due's Atmel ATSAM3X8E microcontrollers.

Using a capture object you can measure any duty and period of a digital signal. Consult the examples which come with the library, to know how to use it.

I hope it helps.