# Ref: https://learn.adafruit.com/adafruit-i2c-qt-rotary-encoder/python-circuitpython import board from adafruit_seesaw import seesaw, rotaryio, digitalio import busio SDA = board.GP0 SCL = board.GP1 i2c = busio.I2C(SCL, SDA) seesaw = seesaw.Seesaw(i2c, 0x36) seesaw.pin_mode(24, seesaw.INPUT_PULLUP) button = digitalio.DigitalIO(seesaw, 24) button_held = False encoder = rotaryio.IncrementalEncoder(seesaw) last_position = None while True: # negate the position to make clockwise rotation positive position = -encoder.position if position != last_position: last_position = position print("Position: {}".format(position)) if not button.value and not button_held: button_held = True print("Button pressed") if button.value and button_held: button_held = False print("Button released")