Skip to content

Instantly share code, notes, and snippets.

@prcutler
Last active November 29, 2021 18:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prcutler/ae6619cde401d246ba9017e644bd6e34 to your computer and use it in GitHub Desktop.
Save prcutler/ae6619cde401d246ba9017e644bd6e34 to your computer and use it in GitHub Desktop.
CircuitPython MacroPad Encoder

while True: # Read encoder position. If it's changed, sZoom in or out. position = macropad.encoder

if position != last_position:

app_index = position % len(apps)

apps[app_index].switch()

last_position = position

if position > last_position:
    Keyboard.press('Z')
elif position < last_position:
    Keyboard.press(Keycode.SHIFT, 'Z')
else:
    pass


    REPL:

    code.py output:

Traceback (most recent call last): File "code.py", line 112, in TypeError: unsupported types for gt: 'int', 'NoneType'

Code done running.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment