Created
February 4, 2013 22:18
-
-
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
This file contains hidden or 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
| 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