Skip to content

Instantly share code, notes, and snippets.

@FoamyGuy
Created May 28, 2021 01:53
Show Gist options
  • Save FoamyGuy/3e3fd8a3cf99504b71e807059d387643 to your computer and use it in GitHub Desktop.
Save FoamyGuy/3e3fd8a3cf99504b71e807059d387643 to your computer and use it in GitHub Desktop.
test for brightness up/down control codes
import usb_hid
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
from adafruit_hid.consumer_control import ConsumerControl
import time
# HID setup
kbd = Keyboard(usb_hid.devices)
cc = ConsumerControl(usb_hid.devices)
from adafruit_circuitplayground import cp
while True:
if cp.button_a:
print("Button A pressed!")
cc.send(0x6f)
time.sleep(0.5)
if cp.button_b:
print("Button B pressed!")
cc.send(0x70)
time.sleep(0.5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment