diff --git a/code.py b/code.py index f301245..46a9d5d 100644 --- a/code.py +++ b/code.py @@ -1 +1,27 @@ -print("Hello World!") +import board +import digitalio +import time +import usb_hid +from adafruit_hid.consumer_control_code import ConsumerControlCode +from adafruit_hid.consumer_control import ConsumerControl + +clkPin = digitalio.DigitalInOut(board.GP2) +dtPin = digitalio.DigitalInOut(board.GP1) +dtPin.direction= digitalio.Direction.INPUT +clkPin.direction = digitalio.Direction.INPUT +clkPin.pull = digitalio.Pull.UP +dtPin.pull = digitalio.Pull.UP + +previousValue = True +consumer_control = ConsumerControl(usb_hid.devices) + +while True: + if previousValue != clkPin.value: + if clkPin.value == False: + if dtPin.value == False: + print('left') + consumer_control.send(ConsumerControlCode.VOLUME_DECREMENT) + else: + print('right') + consumer_control.send(ConsumerControlCode.VOLUME_INCREMENT) + previousValue = clkPin.value \ No newline at end of file diff --git a/lib/adafruit_hid/__init__.mpy b/lib/adafruit_hid/__init__.mpy index 29daa94..601d2c3 100644 Binary files a/lib/adafruit_hid/__init__.mpy and b/lib/adafruit_hid/__init__.mpy differ diff --git a/lib/adafruit_hid/consumer_control.mpy b/lib/adafruit_hid/consumer_control.mpy index ff510dc..02cb9dc 100644 Binary files a/lib/adafruit_hid/consumer_control.mpy and b/lib/adafruit_hid/consumer_control.mpy differ diff --git a/lib/adafruit_hid/consumer_control_code.mpy b/lib/adafruit_hid/consumer_control_code.mpy index b6fc457..618edca 100644 Binary files a/lib/adafruit_hid/consumer_control_code.mpy and b/lib/adafruit_hid/consumer_control_code.mpy differ diff --git a/lib/adafruit_hid/gamepad.mpy b/lib/adafruit_hid/gamepad.mpy deleted file mode 100644 index 54f4a25..0000000 Binary files a/lib/adafruit_hid/gamepad.mpy and /dev/null differ diff --git a/lib/adafruit_hid/keyboard.mpy b/lib/adafruit_hid/keyboard.mpy index 6fe3ace..12b45b9 100644 Binary files a/lib/adafruit_hid/keyboard.mpy and b/lib/adafruit_hid/keyboard.mpy differ diff --git a/lib/adafruit_hid/keyboard_layout_base.mpy b/lib/adafruit_hid/keyboard_layout_base.mpy new file mode 100644 index 0000000..cccbe78 Binary files /dev/null and b/lib/adafruit_hid/keyboard_layout_base.mpy differ diff --git a/lib/adafruit_hid/keyboard_layout_us.mpy b/lib/adafruit_hid/keyboard_layout_us.mpy index 89f0856..7b3398c 100644 Binary files a/lib/adafruit_hid/keyboard_layout_us.mpy and b/lib/adafruit_hid/keyboard_layout_us.mpy differ diff --git a/lib/adafruit_hid/keycode.mpy b/lib/adafruit_hid/keycode.mpy index 106bba1..4a30986 100644 Binary files a/lib/adafruit_hid/keycode.mpy and b/lib/adafruit_hid/keycode.mpy differ diff --git a/lib/adafruit_hid/mouse.mpy b/lib/adafruit_hid/mouse.mpy index 6289bd4..9e09cc3 100644 Binary files a/lib/adafruit_hid/mouse.mpy and b/lib/adafruit_hid/mouse.mpy differ