Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

Encoder library for Raspberry Pi for measuring quadrature encoded signals.

Project description

Raspberry Pi Rotary Encoder Library

Encoder library for Raspberry Pi for measuring quadrature encoded signals.

About

Encoder class allows to work with rotary encoder which connected via two pin A and B (EN11 for example). Works only on interrupts because all RPi pins allow that. This library is a simple port of the Arduino Encoder library (https://github.com/PaulStoffregen/Encoder)

Installation

$ pip install Encoder

Usage

To use it, you need to connect pins A and B and GND of the rotary encoder to two pins and GND of the Raspberry Pi, for example 24 and 10. Then just use it:

import Encoder

enc = Encoder.Encoder(24, 10)
enc.read()

You can use two or more rotary encoders:

import Encoder

enc_1 = Encoder.Encoder(24, 10)
enc_2 = Encoder.Encoder(25, 9)

Note

If the encoder works in the wrong direction, for example, it reduces the position when turning clockwise, you just need to swap pins A and B in the code.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for Encoder, version 1.1
Filename, size File type Python version Upload date Hashes
Filename, size Encoder-1.1-py3-none-any.whl (2.9 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size Encoder-1.1.tar.gz (2.1 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page