GithubHelp home page GithubHelp logo

encoder's Introduction

ClickEncoder

Arduino library to handle rotary encoders with buttons as a user input device. Arduino RotaryEncoder with Button Implementation.

  • Timer-Based: Works on any IO-Pin.
  • Supports rotary acceleration, so when the encoder is rotated faster, the encoders value will increment faster
  • Button reports multiple states: Clicked, DoubleClicked, Held and Released

Encoder and button can be connected to any input pin, as this library requires it's timer interrupt service routine ClickEncoder:service() to be called every millisecond. The example uses TimerOne for that.

See the example application ClickEncoderTest for details, or see it in action at my modified reflow oven controller

Encoder

The library supports acceleration, so when the encoder is rotated faster, the encoders value will increment faster.

Acceleration can be enabled or disabled at runtine using setAccelerationEnabled(bool).

For instance, it makes sense to disable acceleration when entering a configuration menu that will be navigated using the encoder.

Please note that the acceleration parameters have been tuned for 1ms timer intervals, and need to be changed if you decide to call the service method in another interval. (You'd need to increase ENC_ACCEL_INC and ENC_ACCEL_INC).

Depending on the type of your encoder, you can define use the constructors parameter stepsPerNotch an set it to either 1, 2 or 4 steps per notch, with 1 being the default.

If you have trouble with certain encoders, try

#define ENC_DECODER (1 << 2)

to use a table-based decoder, which can then be tuned using

#define ENC_HALFSTEP

The default is ENC_HALFSTEP 1.

Button

The Button reports multiple states: Clicked, DoubleClicked, Held and Released. You can fine-tune the timings in the library's header file.

If your encoder does not have a button, and you need to save program memory, use #define WITHOUT_BUTTON 1 prior including ClickEncoder.h, and ignore the third parameter BTN of the constructor.

encoder's People

Contributors

0xpit avatar andyhunti avatar toeknee avatar joergkeller avatar valeros avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.