From Pinguino
Jump to: navigation, search




from: http://vivaphp.net/pinguino/pulsein/pulse.c

Measures the length (in microseconds) of a pulse on the pin.

State is HIGH or LOW, the type of pulse to measure.

Works on pulses from 2-3 microseconds to 3 minutes in length, but must be called at least a few dozen microseconds before the start of the pulse.


 unsigned long pulseIn(unsigned char pin, unsigned char state, unsigned long timeout);

pin: Pin to measure the pulse (must be configured as INPUT).

state: Type of pulse.

timeout: Timeout for finding a pulse.(If it finds the start of the pulse, it will wait for it to end)

return: Length of the pulse.