I forked this lib from and renamed .ccp and .h, by adding _Wemos, to be sure that the Arduino IDE does not uses the wrong library. Changed also pins in examples.
Encoder counts pulses from quadrature encoded signals, which are commonly available from rotary knobs, motor or shaft sensors and other position sensors.
http://www.pjrc.com/teensy/td_libs_Encoder.html