Last active
January 4, 2017 15:10
-
-
Save ofgulban/bacaa96049684357161c1fc4b2b9bd04 to your computer and use it in GitHub Desktop.
An example script to see how https://github.com/ofgulban/griffin-powermate works.
This file contains 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
"""Test Griffin Powermate library using pywinusb.""" | |
from griffin_powermate import GriffinPowermate | |
def rotation_listener(data): | |
"""Print powermate input only for rotation.""" | |
global dial_click | |
if data[1] == 1 : | |
dial_click = True | |
elif data[2] > 127: | |
print data[2] - 256 | |
else: | |
print data[2] | |
devices = GriffinPowermate.find_all() | |
# use the first powermate available | |
powermate = devices[0] | |
powermate.open() | |
powermate.on_event('raw', rotation_listener) | |
# set the light (0 - 255) | |
powermate.set_brightness(0) | |
dial_click = False | |
while dial_click is False: | |
x = 1 | |
powermate.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment