Skip to content

Instantly share code, notes, and snippets.

@pingswept
Created February 4, 2013 22:18
Show Gist options
  • Select an option

  • Save pingswept/4710240 to your computer and use it in GitHub Desktop.

Select an option

Save pingswept/4710240 to your computer and use it in GitHub Desktop.
A snippet of code from the Color Commons interactive light sculpture in Boston, USA http://newamericanpublicart.com/colorcommons/index.html
try:
program = int(d[color[0:25].lower()])
except KeyError:
print 'color {0} not found'.format(color)
program = int(d['red'])
command = 'X04%(number)2.2X' % {"number": program}
print 'Translated {0} to {1}'.format(color, command)
if (command in allowed_commands):
pytronics.serialWrite(command, speed=9600)
else:
print "Command {0} is not one of the allowed commands.".format(command)
return('<?xml version="1.0" encoding="UTF-8"?><Response></Response>')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment