Some simple logic to use a rotary encoder in Elixir. Turning clockwise will increment a counter, turning counterclockwise will decrement it. You can call RotaryEncodex.get_value()
to get the current value of the counter.
If available in Hex, the package can be installed
by adding rotaryencodex
to your list of dependencies in mix.exs
:
def deps do
[
{:rotaryencodex, "~> 0.1.0"}
]
end
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/button.