Syntax
int PULSIN (int pin, int state);
Description
Measure an input pulse on pin at
level, returning the value.
The IO direction of pin will be
set to input.
If pin is already at level when the function
is called it will wait to a transition to the opposite level.
The function will wait 1 second for
pin to go to level. The length of time is measured in
microseconds(us). The minimum pulse that can be measured is 1
microseconds. If pin does not go to level or remains at level
longer than 1 second 0 is returned.
Example
case
32:
prinf("\n Measure PULSIN on pin 0, four times as
low pulse then high pulse\n");
for (i=0; i<4; i++)
{
printf ("%d\n", PULSIN (0, 0)
);
}
for
(i=0; i<4; i++)
{
printf ("%d\n", PULSIN (0, 1)
);
}
See also