Loading...
Searching...
No Matches
Rotary encoder

The rotary encoder (ENC1) on D3 and D4, and its push switch on D2. More...

Classes

class  Encoder
 The shield's rotary encoder (ENC1) and its push switch. More...

Functions

 encoder ()
 Gets the shield's rotary encoder.

Detailed Description

The rotary encoder (ENC1) on D3 and D4, and its push switch on D2.

The shield has pull-ups and RC filters on all three lines, so they are inputs with no pull of their own and read low when closed. Pin interrupts count the turns, so none are missed while your program does something else.

Function Documentation

◆ encoder()

encoder ( )

Gets the shield's rotary encoder.

The first call sets up D2-D4 and starts counting from 0.

Returns
The Encoder object (the same one every call).
Example
knob = shield.encoder()
print(knob.position(), knob.pressed())