Created
May 26, 2015 08:56
-
-
Save dave-irvine/dbec2584e7508cbfc79e to your computer and use it in GitHub Desktop.
Luxafor Python
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
# Luxafor via Python | |
# Dave Irvine www.daveirvine.me @dave_irvine | |
# Get PyUSB from: | |
# http://walac.github.io/pyusb/ | |
#!/usr/bin/python | |
import usb.core | |
import usb.util | |
import sys | |
# find our device | |
dev = usb.core.find(idVendor=0x04d8, idProduct=0xf372) | |
# was it found? | |
if dev is None: | |
raise ValueError('Device not found') | |
# Linux kernel sets up a device driver for USB device, which you have | |
# to detach. Otherwise trying to interact with the device gives a | |
# 'Resource Busy' error. | |
try: | |
dev.detach_kernel_driver(0) | |
except Exception, e: | |
pass | |
dev.set_configuration() | |
dev.write(1, [0, 0]) | |
# "red" == 82 | |
# "green" == 71 | |
# "blue" == 66 | |
# "yellow" == 89 | |
dev.write(1, [0, 82]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!
Here are some more colors.