Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class Controller:
"""docstring for Controller"""
NumButtons = 8
def __init__(self, devName, devKeys):
self.devPath = "/dev/" + devName
try:
print "Connecting to " + self.devPath
self.serial = serial.Serial(self.devPath, 9600, timeout=10)
except Exception as inst:
print type(inst) # the exception instance
print inst.args # arguments stored in .args
print inst
print "Connection to " + self.devPath + " failed!"
self.connected = False
else:
print "Connection to " + self.devPath + " successful!"
self.connected = True
self.devKeys = devKeys
self.device = Device(devKeys)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.