Esempio n. 1
0
try:
    interfaceKit.waitForAttach(10000)
except PhidgetException, e:
    print "Phidget Exception %i: %s" % (e.code, e.message)
    try:
        interfaceKit.closePhidget()
    except PhidgetException, e:
        print "Phidget Exception %i: %s" % (e.code, e.message)
        print "Exiting...."
        exit(1)
    print "Exiting...."
    exit(1)


print "Output Count: "+str(interfaceKit.getOutputCount())

time.sleep(3)

print "Output 0 is currently in state "+str(interfaceKit.getOutputState(0))
print "Press Enter to toggle output 0"
chr = sys.stdin.read(1)
if interfaceKit.getOutputState(0) is False:
    print "setting output dtate to True"
    interfaceKit.setOutputState(0, True)
    print "done"
else:
    print "setting output state to False"
    interfaceKit.setOutputState(0, False)
    print "done"
Esempio n. 2
0
try:
    interfaceKit.waitForAttach(10000)
except PhidgetException, e:
    print "Phidget Exception %i: %s" % (e.code, e.message)
    try:
        interfaceKit.closePhidget()
    except PhidgetException, e:
        print "Phidget Exception %i: %s" % (e.code, e.message)
        print "Exiting...."
        exit(1)
    print "Exiting...."
    exit(1)
else:
    displayDeviceInfo()

print "Output Count: " + str(interfaceKit.getOutputCount())

time.sleep(3)

print "Output 0 is currently in state " + str(interfaceKit.getOutputState(0))
print "Press Enter to toggle output 0"
chr = sys.stdin.read(1)
if interfaceKit.getOutputState(0) is False:
    print "setting output dtate to True"
    interfaceKit.setOutputState(0, True)
    print "done"
else:
    print "setting output state to False"
    interfaceKit.setOutputState(0, False)
    print "done"