grove.grove_optical_rotary_encoder
¶
- This is the code for
Grove - Optical Rotary Encoder(TCUT1600X01) <https://www.seeedstudio.com/Grove-Optical-Rotary-Encoder-TCUT1600X0-p-3142.html>`_
Examples
from grove.grove_button import GroveButton
import time, sys
# connect to pin 5 (slot D5)
PIN = 5
encoder = GroveOpticalRotaryEncoder(PIN)
# Read the value every second and detect motion
while True:
print("
- Position: {0} “.format(encoder.position()), file=sys.stderr, end=’’)
time.sleep(0.001)
Classes¶
GroveOpticalRotaryEncoder
: Grove optical Rotary Encoder(TCUT1600X01) class
- class grove.grove_optical_rotary_encoder.GroveOpticalRotaryEncoder(pin1, pin2=None)[source]¶
Grove optical Rotary Encoder(TCUT1600X01) class
- Parameters:
pin (int) – the number of gpio/slot your grove device connected.
Inheritance
digraph inheritanced4a2880fe5 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "GroveOpticalRotaryEncoder" [URL="#grove.grove_optical_rotary_encoder.GroveOpticalRotaryEncoder",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Grove optical Rotary Encoder(TCUT1600X01) class"]; }