added test volumen control

Signed-off-by: Ebbe Baß <ebbe@ping-mee.de>
master
Ebbe Baß 2022-04-26 18:00:29 +02:00
parent ff93288428
commit b3f36c1d1f
10 changed files with 27 additions and 1 deletions

28
code.py
View File

@ -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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.