Skip to content

Instantly share code, notes, and snippets.

@k0d
Created March 14, 2012 18:02
Show Gist options
  • Save k0d/2038259 to your computer and use it in GitHub Desktop.
Save k0d/2038259 to your computer and use it in GitHub Desktop.
USB Lamp for Artem
import usb.core
from binascii import unhexlify as hex2lamp
def set_color(color):
print 'Attempting to set color to %s' % color
colors = dict(red='ff0000', green='00ff00', blue='0000ff')
if color not in colors:
print 'Color %s not found' % color
return False
else:
hex = colors[color]
print 'Color %s found, hex set to %s' % (color, hex)
set_hex(hex)
return True
def set_hex(hex):
print 'Set lamp to %s' % hex
return send_to_lamp(hex)
def send_to_lamp(hex):
return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment