pyupm_wheelencoder module¶
-
class
pyupm_wheelencoder.
WheelEncoder
(pin)[source]¶ Bases:
object
API for the DFRobot Wheel Encoder.
ID: wheelencoder
Name: Wheel Encoder
Category: other
Manufacturer: dfrobot
Link:http://www.dfrobot.com/index.php?route=product/product&product_id=98
Connection: gpio This sensor was developed for the DFRobot Wheel Encoder, though it could be used for any counting time-based task.
When you instantiate a class of this type, the gpio pin specified is connected to an interrupt. Whenever a low to high transition occurs on the gpio pin, the internal counter is incremented by one.
This class also includes a millisecond counter, so that you can correlate the number of counts to a time period for calculating an RPM or other value as needed.
C++ includes: wheelencoder.hpp
-
clearCounter
()[source]¶ void clearCounter()
Resets the counter to 0. The counter should be stopped via stopCounter() prior to calling this function.
-
getMillis
()[source]¶ uint32_t getMillis()
Returns the number of milliseconds elapsed since initClock() was last called.
Elapsed milliseconds
-