Skip to content

Instantly share code, notes, and snippets.

@kelliott121
Created May 18, 2017 17:03
Show Gist options
  • Save kelliott121/2cfaeb08006bc5e3f81fbe822cb425fa to your computer and use it in GitHub Desktop.
Save kelliott121/2cfaeb08006bc5e3f81fbe822cb425fa to your computer and use it in GitHub Desktop.
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