DigitalReadPulseWidth()
Reads the pulse width in uS of an active high or active low digital pulse with the option to send a stimulus pulse on the same or a different channel. If a pulse is not detected within the specified timeout a timeout status is returned.
Syntax
DigitalReadPulseWidth(unsigned char stimChan, unsigned char stimType, unsigned char respChan, unsigned char respType, unsigned long timeout, unsigned long* width);
stimChan
The digital output channel to send a stimulus pulse on. Only used if stimType is non-zero.
stimType
The type of stimulus pulse to send:
- 0 - No stimulus pulse
- 1 - Active low stimulus pulse (High→Low→High)
- 2 - Active high stimulus pulse (Low→High→Low
respChan
The digital input channel to monitor for the response pulse.
respType
The polarity of the pulse width:
- 0 - Low
- 1 - High
timeout
The maximum time to wait for the response pulse.
width
A pointer to an unsigned long to store the detected pulse width in uS.
Returns
int status