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.

counter()[source]

uint32_t counter()

Gets the current counter value

counter value

getMillis()[source]

uint32_t getMillis()

Returns the number of milliseconds elapsed since initClock() was last called.

Elapsed milliseconds

initClock()[source]

void initClock()

Resets the clock

startCounter()[source]

void startCounter()

Starts the counter. This function will also clear the current count and reset the clock.

stopCounter()[source]

void stopCounter()

Stops the counter