menu_book Course Curriculum (Raspberry Pi) expand_more
Linux & Setup
GPIO Digital I/O
Sensors & Buses
Automation
Networking & Services
rotary encoder
Learn rotary encoder in Raspberry Pi with a dedicated explanation, a concept-specific example, practical cautions, and a mastery check.
12 min read
•
Advanced
raspberry-pi-047.py
python
from gpiozero import RotaryEncoder
enc=RotaryEncoder(a=17,b=18,max_steps=0)
enc.when_rotated=lambda: print('steps:',enc.steps)
input('rotate; Enter to stop')
What to watch
Content source & attribution
Original Syntaxis Content · Original Syntaxis Content