本文整理汇总了Python中Phidgets.Devices.InterfaceKit.InterfaceKit.isAttached方法的典型用法代码示例。如果您正苦于以下问题:Python InterfaceKit.isAttached方法的具体用法?Python InterfaceKit.isAttached怎么用?Python InterfaceKit.isAttached使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phidgets.Devices.InterfaceKit.InterfaceKit
的用法示例。
在下文中一共展示了InterfaceKit.isAttached方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from Phidgets.Devices.InterfaceKit import InterfaceKit [as 别名]
# 或者: from Phidgets.Devices.InterfaceKit.InterfaceKit import isAttached [as 别名]
def run():
kit = InterfaceKit()
try:
try:
kit.openPhidget()
kit.setOnAttachHandler(attached)
kit.setOnDetachHandler(detached)
if not kit.isAttached():
print "Please attach the interface kit!"
raw_input()
except PhidgetException as e:
print ("Phidget exception %i: %s" % (e.code,e.detail))
except RuntimeError as e:
print ("Runtime error: %s" % e.message)
except Exception as e:
print ("Unknown error: %s" % (e.message))
stop(kit)
示例2: set_bbias
# 需要导入模块: from Phidgets.Devices.InterfaceKit import InterfaceKit [as 别名]
# 或者: from Phidgets.Devices.InterfaceKit.InterfaceKit import isAttached [as 别名]
def set_bbias(state):
"""Set back bias to state"""
state_dict = {"On" : True,
"Off" : False}
setting = state_dict[state]
## Attach to Phidget controller
relay = InterfaceKit()
relay.openPhidget()
relay.waitForAttach(10000)
## Check if successful
if relay.isAttached():
print "Done!"
else:
print "Failed to connect to Phidget controller"
## Set output to 0 and close
relay.setOutputState(0, setting)
print "BSS is now {0}".format(state)
relay.closePhidget()
return
示例3: InterfaceKit
# 需要导入模块: from Phidgets.Devices.InterfaceKit import InterfaceKit [as 别名]
# 或者: from Phidgets.Devices.InterfaceKit.InterfaceKit import isAttached [as 别名]
from Phidgets.Devices.InterfaceKit import InterfaceKit
kit = InterfaceKit()
kit.openPhidget()
kit.waitForAttach(1000)
print kit.isAttached()
示例4: SitwPhidgetsKey
# 需要导入模块: from Phidgets.Devices.InterfaceKit import InterfaceKit [as 别名]
# 或者: from Phidgets.Devices.InterfaceKit.InterfaceKit import isAttached [as 别名]
#.........这里部分代码省略.........
elif (Key == "Log_Brightness"):
sitwPara.Log_Brightness = str(val)
else:
pass
print('[' + Section + '] ' + Key + ' = ' + val)
continue
except: #IOError
self.prtMsg('Error: readIniFile()')
finally:
pass
def iniData(self):
return (("General",
("KeyCount",
"Sensitivity",
"MovingPace",
"SampleInterval_Key",
"SampleInterval_Env",
"Log_Action",
"Log_Brightness")),)
#Information Display Function
def displayDeviceInfo(self):
print("|------------|----------------------------------|--------------|------------|")
print("|- Attached -|- Type -|- Serial No. -|- Version -|")
print("|------------|----------------------------------|--------------|------------|")
print("|- %8s -|- %30s -|- %10d -|- %8d -|" % (self.interfaceKit.isAttached(), self.interfaceKit.getDeviceName(), self.interfaceKit.getSerialNum(), self.interfaceKit.getDeviceVersion()))
print("|------------|----------------------------------|--------------|------------|")
print("Number of Digital Inputs: %i" % (self.interfaceKit.getInputCount()))
print("Number of Digital Outputs: %i" % (self.interfaceKit.getOutputCount()))
print("Number of Sensor Inputs: %i" % (self.interfaceKit.getSensorCount()))
#Event Handler Callback Functions
def inferfaceKitAttached(self, e):
attached = e.device
print("InterfaceKit %i Attached!" % (attached.getSerialNum()))
def interfaceKitDetached(self, e):
detached = e.device
print("InterfaceKit %i Detached!" % (detached.getSerialNum()))
def interfaceKitError(self, e):
try:
source = e.device
print("InterfaceKit %i: Phidget Error %i: %s" % (source.getSerialNum(), e.eCode, e.description))
except PhidgetException as e:
print("Phidget Exception %i: %s" % (e.code, e.details))
def interfaceKitInputChanged(self, e):
source = e.device
print("InterfaceKit %i: Input %i: %s" % (source.getSerialNum(), e.index, e.state))
def interfaceKitSensorChanged(self, e):
if not self.KeyMatReady: