Created
May 28, 2021 01:53
-
-
Save FoamyGuy/3e3fd8a3cf99504b71e807059d387643 to your computer and use it in GitHub Desktop.
test for brightness up/down control codes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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