Simple "count" question
Beavis3215
Posts: 229
long count ( int pin, long duration ) Count number of low to high transitions an external input applies to an I/O pin over a certain period of time. Parameters pin I/O pin number duration Amount of time the measurement counts transitions Returns The number of low to high transitions
This is out of the propeller.h manual.
Does anyone know the default units of "a certain period of time"?
I am assuming milliseconds, as most of the other examples of timing commands use milliseconds.
Suppose that pin 19 is already an input, and is being used elsewhere in the program. Would int t = count(19, 1000) and the other function of pin 19 be possible at the same time?
Comments
"Suppose that pin 19 is already an input, and is being used elsewhere in the program. Would int t = count(19, 1000) and the other function of pin 19 be possible at the same time?"
Not in the same cog, since the count() function will run for the specified duration. Make int t global and use count() in a different cog.