Skip to content

Latest commit

 

History

History
24 lines (17 loc) · 908 Bytes

Encoder.md

File metadata and controls

24 lines (17 loc) · 908 Bytes

Rotary Encoder

  • KEYWORDS: Module,Rotary,Encoder,Rotary Encoder

Incremental Rotary Encoders supported by this module use two 'switches', which change state in a Gray Code. This allows them to detect either clockwise or anticlockwise movement.

The encoder should have 3 pins (one common, and two switched). The common should be connected to 3.3v, and the two switched pins should be connected to two pins on Espruino, which should be supplied to the module.

Rotary encoders are handled by the [[Encoder.js]] module.

var step = 0;
require("Encoder").connect(A1,A2,function (direction) {
  step += direction;
  print(step);
});

Using

  • APPEND_USES: Encoder