CounterBase¶
-
class
wpilib.interfaces.
CounterBase
[source]¶ Bases:
object
Interface for counting the number of ticks on a digital input channel. Encoders, Gear tooth sensors, and counters should all subclass this so it can be used to build more advanced classes for control and driving.
All counters will immediately start counting -
reset()
them if you need them to be zeroed before use.-
class
EncodingType
[source]¶ Bases:
object
The number of edges for the counterbase to increment or decrement on
-
k1X
= 0¶ Count only the rising edge
-
k2X
= 1¶ Count both the rising and falling edge
-
k4X
= 2¶ Count rising and falling on both channels
-
-
getDirection
()[source]¶ Determine which direction the counter is going
Returns: True for one direction, False for the other
-
getPeriod
()[source]¶ Get the time between the last two edges counted
Returns: the time between the last two ticks in seconds
-
class