當前位置: 首頁>>代碼示例>>Python>>正文


Python InterfaceKit.isAttached方法代碼示例

本文整理匯總了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)
開發者ID:tfaris,項目名稱:phidgetvol,代碼行數:20,代碼來源:main.py

示例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
開發者ID:Snyder005,項目名稱:ccdcontroller,代碼行數:26,代碼來源:ccdsetup.py

示例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()
開發者ID:carmenalab,項目名稱:brain-python-interface,代碼行數:7,代碼來源:test_phidgets_joystick.py

示例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:
開發者ID:screensinthewild,項目名稱:Phidgets-Light-Keypad,代碼行數:70,代碼來源:SitwPhidgetsKey.py


注:本文中的Phidgets.Devices.InterfaceKit.InterfaceKit.isAttached方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。