countio¶
Support for edge counting
The countio module contains logic to read and count edge transistions
Warning
This module is not available in some SAMD21 (aka M0) builds. See the Support Matrix for more info.
All classes change hardware state and should be deinitialized when they
are no longer needed if the program continues after use. To do so, either
call deinit() or use a context manager. See
Lifetime and ContextManagers for more info.
-
class
countio.Counter(pin_a)¶ Counter will keep track of the number of falling edge transistions (pulses) on a given pin
-
count:int¶ The current count in terms of pulses.
-
deinit(self)¶ Deinitializes the Counter and releases any hardware resources for reuse.
-
__enter__(self)¶ No-op used by Context Managers.
-
__exit__(self)¶ Automatically deinitializes the hardware when exiting a context. See Lifetime and ContextManagers for more info.
-
reset(self)¶ Resets the count back to 0.
-