使用方法:
from machine import sleep_ms from encoder import Encoder # or from pyb_encoder import Encoder e = Encoder('X11', 'X12') # optional: add pin_mode=Pin.PULL_UP lastval = e.value while True: val = e.value if lastval != val: lastpos = val print(val) sleep_ms(100) github.com
micropython-stm-lib - A collection of modules and examples for MicroPython running on an STM32F4DISCOVERY board