JAREL is a fork of MPrograms's SimpleRotary Arduino Encoder library, aiming to add more functionality to an already great library. Refer to SimpleRotary's README and examples for all info on the base usage of the library.
- Position system for every encoder, accessible via the
jarel.position
parameter.jarel.lastPosition
is also available and contains the value ofjarel.position
in the last loop. - The definition of a
jarel
object now accepts the optional parameterspositionDefault
,limited
,positionMin
,positionMax
andsteps
, in this order.positionDefault
is an public integer that sets the defaultjarel.position
when the program starts (default value0
)limited
is a boolean that enables the upper and lower limits ofjarel.position
(default valuefalse
)positionMin
andpositionMax
are public integers that set the upper and lower limits ofjarel.position
whenlimited
is set totrue
(default values0
and100
)steps
is how many positions will increase/decrease for each encoder click, iflimited
is set totrue
this should be a multiple ofpositionDefault
,positionMin
andpositionMax
or your position will get out of phase when it reaches the limits (default value1
)
- The position can be manually controlled via the
setPosition
,resetPosition
,increasePosition
anddecreasePosition
methods:setPosition
takes an integer and sets it as the currentjarel.position
, updatingjarel.lastPosition
in the processresetPosition
takes no arguments and resetsjarel.position
tojarel.positionDefault
increasePosition
anddecreasePosition
take an integer argument and respectively increase and decreasejarel.position
by the passed integer, if no parameter is passed, it will increase or decrease by 1
- The position system can be deactivated and reactivated using
jarel.disable()
andjarel.enable
, these methods will change thejarel.enabled
public boolean parameter
- Add wrap-around option when the limits are turned on
- Add reverse direction option