Adafruit_Learning_System_Gu.../Make_It_A_Keyboard/keyboard-multimedia/code.py
2022-02-18 16:51:56 -05:00

20 lines
584 B
Python

# SPDX-FileCopyrightText: 2018 Anne Barela for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import usb_hid
from adafruit_circuitplayground.express import cpx
from adafruit_hid.consumer_control import ConsumerControl
from adafruit_hid.consumer_control_code import ConsumerControlCode
cc = ConsumerControl(usb_hid.devices)
while True:
if cpx.button_a:
cc.send(ConsumerControlCode.VOLUME_INCREMENT)
while cpx.button_a:
pass
if cpx.button_b:
cc.send(ConsumerControlCode.VOLUME_DECREMENT)
while cpx.button_b:
pass