当前位置: 首页>>代码示例>>Python>>正文


Python InterfaceKit.setOnOutputChangeHandler方法代码示例

本文整理汇总了Python中Phidgets.Devices.InterfaceKit.InterfaceKit.setOnOutputChangeHandler方法的典型用法代码示例。如果您正苦于以下问题:Python InterfaceKit.setOnOutputChangeHandler方法的具体用法?Python InterfaceKit.setOnOutputChangeHandler怎么用?Python InterfaceKit.setOnOutputChangeHandler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Phidgets.Devices.InterfaceKit.InterfaceKit的用法示例。


在下文中一共展示了InterfaceKit.setOnOutputChangeHandler方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from Phidgets.Devices.InterfaceKit import InterfaceKit [as 别名]
# 或者: from Phidgets.Devices.InterfaceKit.InterfaceKit import setOnOutputChangeHandler [as 别名]
class PhidgetInterface:

    def __init__(self):

        rospy.loginfo("Initializing PhidgetInterface")

        self.batteryVoltage = 0
        self.forwardRange = 1
        self.aftRange = 2

        self.interfaceKit = InterfaceKit()
        
        self.forwardRangeMessage = Range()
        self.forwardRangeMessage.header.frame_id = 'infrared_forward'
        self.forwardRangeMessage.radiation_type = Range.INFRARED
        self.forwardRangeMessage.field_of_view = 0.018
        self.forwardRangeMessage.min_range = 0.2
        self.forwardRangeMessage.max_range = 0.8
        self.forwardRangeMessage.range = 0.0

        self.aftRangeMessage = Range()
        self.aftRangeMessage.header.frame_id = 'infrared_aft'
        self.aftRangeMessage.radiation_type = Range.INFRARED
        self.aftRangeMessage.field_of_view = 0.018
        self.aftRangeMessage.min_range = 0.2
        self.aftRangeMessage.max_range = 0.8
        self.aftRangeMessage.range = 0.0

        self.sensorPublisher = rospy.Publisher('bogies', Range)

        self.interfaceKit.setOnAttachHandler(self.interfaceKitAttached)
        self.interfaceKit.setOnDetachHandler(self.interfaceKitDetached)
        self.interfaceKit.setOnErrorhandler(self.interfaceKitError)
        self.interfaceKit.setOnInputChangeHandler(self.interfaceKitInputChanged)
        self.interfaceKit.setOnOutputChangeHandler(self.interfaceKitOutputChanged)
        self.interfaceKit.setOnSensorChangeHandler(self.interfaceKitSensorChanged)

        try:
            self.interfaceKit.openPhidget()

        except PhidgetException, e:
            rospy.logerror("openPhidget() failed")
            rospy.logerror("code: %d" % e.code)
            rospy.logerror("message", e.message)

            raise

        try:
            self.interfaceKit.waitForAttach(10000)

        except PhidgetException, e:
            rospy.logerror("waitForAttach() failed")
            rospy.logerror("code: %d" % e.code)
            rospy.logerror("message", e.message)
    
            raise
开发者ID:billmania,项目名称:nomad,代码行数:58,代码来源:short_range_and_battery.py

示例2: PhidgetsEventThread

# 需要导入模块: from Phidgets.Devices.InterfaceKit import InterfaceKit [as 别名]
# 或者: from Phidgets.Devices.InterfaceKit.InterfaceKit import setOnOutputChangeHandler [as 别名]
class PhidgetsEventThread(QtCore.QThread):
    def __init__(self, parent=None):
        super(PhidgetsEventThread, self).__init__(parent)

        try:
            self.interfaceKit = InterfaceKit()
            self.interfaceKit.openPhidget()
            self.interfaceKit.setOnAttachHandler(self.interfaceKitAttachedEvent)
            self.interfaceKit.setOnDetachHandler(self.interfaceKitDetachEvent)
            self.interfaceKit.setOnErrorhandler(self.interfaceKitErrorSlot)
            self.interfaceKit.setOnInputChangeHandler(self.interfaceKitInputChangedEvent)
            self.interfaceKit.setOnOutputChangeHandler(self.interfaceKitOutputChangedEvent)
            self.interfaceKit.setOnSensorChangeHandler(self.interfaceKitSensorChangedEvent)
        except RuntimeError as e:
            print "Runtime Exception: %s" % (e.details)
            print "Exiting..."
            sys.exit(1)
            
        except PhidgetException as e:
            print "Phidget Exception %i: %s" % (e.code, e.details)
            print "Exiting..."
            sys.exit(1) 
    
    
    #===========================================================================
    # On Interfacekit events, emit signals to main thread for updating GUI
    #===========================================================================
    def interfaceKitAttachedEvent(self, event):
        self.emit(QtCore.SIGNAL("interfaceKitAttachedSlot"), event)
    
    def interfaceKitDetachEvent(self, event):
        self.emit(QtCore.SIGNAL("interfaceKitDetachedSlot"), event)
        
    def interfaceKitErrorSlot(self, event):
        self.emit(QtCore.SIGNAL("interfaceKitErrorSlot"), event)
    
    def interfaceKitInputChangedEvent(self, event):
        self.emit(QtCore.SIGNAL("interfaceKitInputChangedSlot"), event)
    
    def interfaceKitOutputChangedEvent(self, event):
        self.emit(QtCore.SIGNAL("interfaceKitOutputChangedSlot"), event)
    
    def interfaceKitSensorChangedEvent(self, event):
        self.emit(QtCore.SIGNAL("interfaceKitSensorChangedSlot"), event)
    
    def setSensorSensitivity(self, value):
        try:
            for i in range(self.interfaceKit.getSensorCount()):
                self.interfaceKit.setSensorChangeTrigger(i, value)
        except PhidgetException as e:
            print "Could not set sensitivity: %s" % e.details
            
    def run(self):
        self.exec_()
开发者ID:rhblind,项目名称:QInterfaceKit,代码行数:56,代码来源:main.py

示例3: setup_interfaceKit

# 需要导入模块: from Phidgets.Devices.InterfaceKit import InterfaceKit [as 别名]
# 或者: from Phidgets.Devices.InterfaceKit.InterfaceKit import setOnOutputChangeHandler [as 别名]
def setup_interfaceKit():
    #Create an interfacekit object
    try:
        interfaceKit = InterfaceKit()
    except RuntimeError as e:
        print("Runtime Exception: %s" % e.details)
        print("Exiting....")
        exit(1)

    try:
        interfaceKit.setOnAttachHandler(inferfaceKitAttached)
        interfaceKit.setOnDetachHandler(interfaceKitDetached)
        interfaceKit.setOnErrorhandler(interfaceKitError)
        interfaceKit.setOnInputChangeHandler(interfaceKitInputChanged)
        interfaceKit.setOnOutputChangeHandler(interfaceKitOutputChanged)
        interfaceKit.setOnSensorChangeHandler(interfaceKitSensorChanged)
    except PhidgetException as e:
        print("Phidget Exception %i: %s" % (e.code, e.details))
        print("Exiting....")
        exit(1)

    print("Opening phidget object....")

    try:
        #interfaceKit.openPhidget()
        interfaceKit.openRemoteIP(IP, port=5001)
    except PhidgetException as e:
        print("Phidget Exception %i: %s" % (e.code, e.details))
        print("Exiting....")
        exit(1)

    print("Waiting for attach....")

    try:
        interfaceKit.waitForAttach(10000)
    except PhidgetException as e:
        print("Phidget Exception %i: %s" % (e.code, e.details))
        try:
            interfaceKit.closePhidget()
        except PhidgetException as e:
            print("Phidget Exception %i: %s" % (e.code, e.details))
            print("Exiting....")
            exit(1)
        print("Exiting....")
        exit(1)
    return interfaceKit
开发者ID:psas,项目名称:launch-tower-comm,代码行数:48,代码来源:kv-ph-demo.py

示例4: InterfaceKit

# 需要导入模块: from Phidgets.Devices.InterfaceKit import InterfaceKit [as 别名]
# 或者: from Phidgets.Devices.InterfaceKit.InterfaceKit import setOnOutputChangeHandler [as 别名]
    signal.signal(signal.SIGALRM, handler)

    #Create an interfacekit object
    try:
        interfaceKit = InterfaceKit()
    except RuntimeError as e:
        print("Runtime Exception: %s" % e.details)
        print("Exiting....")
        exit(1)

    try:
        interfaceKit.setOnAttachHandler(inferfaceKitAttached)
        interfaceKit.setOnDetachHandler(interfaceKitDetached)
        interfaceKit.setOnErrorhandler(interfaceKitError)
        interfaceKit.setOnInputChangeHandler(interfaceKitInputChanged)
        interfaceKit.setOnOutputChangeHandler(interfaceKitOutputChanged)
        interfaceKit.setOnSensorChangeHandler(interfaceKitSensorChanged)
    except PhidgetException as e:
        print("Phidget Exception %i: %s" % (e.code, e.details))
        print("Exiting....")
        exit(1)

    print("Opening phidget relay board....")

    try:
        interfaceKit.openRemoteIP("192.168.128.2", port=5001, serial=SERIAL_NUM)
    except PhidgetException as e:
        print("Phidget Exception %i: %s" % (e.code, e.details))
        print("Exiting....")
        exit(1)
开发者ID:psas,项目名称:launch-tower-comm,代码行数:32,代码来源:ignition-relay-watchdog.py

示例5: LTCPhidget

# 需要导入模块: from Phidgets.Devices.InterfaceKit import InterfaceKit [as 别名]
# 或者: from Phidgets.Devices.InterfaceKit.InterfaceKit import setOnOutputChangeHandler [as 别名]
class LTCPhidget(object):
    # TODO: can the remote specific events find a disconnected usb cable?
    devserial = 0
    IP = "0.0.0.0"
    port = 0

    input = {}
    output = {}
    sensor = {}

    callback = {'attach': [],
                'detach': [],
                'error': [],
                'output': [],
                'input': [],
                'sensor': []}

    def __init__(self, **kwargs):
        log.debug("Acquiring InterfaceKit")
        self.ik = InterfaceKit()
        log.debug("Registering Handlers")
        self.ik.setOnAttachHandler(self._onAttach)
        self.ik.setOnDetachHandler(self._onDetach)
        self.ik.setOnErrorhandler(self._onError)
        self.ik.setOnOutputChangeHandler(self._onOutput)
        self.ik.setOnInputChangeHandler(self._onInput)
        self.ik.setOnSensorChangeHandler(self._onSensor)

    def start(self):
        log.verbose("Opening remote IP")
        self.ik.openRemoteIP(self.IP, self.port, self.devserial)
        log.debug("Remote IP opened")

    def close(self):
        log.verbose("Closing InterfaceKit")
        self.ik.closePhidget()
        log.debug("Interfac kit closed")

    def add_callback(self, cb, type):
        log.debug("Adding a {} type callback".format(type))
        self.callback[type].append(cb)

    def remove_callback(self, cb, type):
        log.debug("Removing a {} type callback".format(type))
        self.callback[type].remove(cb)

    def _genericCB(self, event, type):
        log.verbose("{} event received".format(type))
        for cb in self.callback[type]:
            cb(event)
        for dev in self.input.itervalues():
            for cb in dev.callback[type]:
                cb(event)
        for dev in self.output.itervalues():
            for cb in dev.callback[type]:
                cb(event)
        for dev in self.sensor.itervalues():
            for cb in dev.callback[type]:
                cb(event)

    def _onAttach(self, event):
        self._genericCB(event, 'attach')

    def _onDetach(self, event):
        self._genericCB(event, 'detach')

    def _onError(self, event):
        log.debug(event.description)
        log.verbose("{} event received".format(type))
        for cb in self.callback['error']:
            cb(event)

    def _onOutput(self, event):
        log.verbose("Output event received")
        for cb in self.callback['output']:
            cb(event)
        try:
            for cb in self.output[event.index].callback['value']:
                cb(event)
        except KeyError:
            pass

    def _onInput(self, event):
        log.verbose("Input event received")
        for cb in self.callback['input']:
            cb(event)
        try:
            for cb in self.input[event.index].callback['value']:
                cb(event)
        except KeyError:
            pass

    def _onSensor(self, event):
        log.verbose("Sensor event received")
        for cb in self.callback['sensor']:
            cb(event)
        try:
            for cb in self.sensor[event.index].callback['value']:
                cb(event)
        except KeyError:
#.........这里部分代码省略.........
开发者ID:psas,项目名称:launch-tower-comm,代码行数:103,代码来源:ltcbackend.py

示例6: Node

# 需要导入模块: from Phidgets.Devices.InterfaceKit import InterfaceKit [as 别名]
# 或者: from Phidgets.Devices.InterfaceKit.InterfaceKit import setOnOutputChangeHandler [as 别名]

#.........这里部分代码省略.........
            cls=self.__class__.__name__
        )

    def __conform__(self, protocol):
        return json.dumps(self.json(), cls=ComplexEncoder)

    def displayDeviceInfo(self):pass
        
    #Event Handler Callback Functions
    def inferfaceKitAttached(self, e):
        attached = e.device
        self.logger.info("InterfaceKit %i Attached!" % (attached.getSerialNum()))

    def interfaceKitDetached(self, e):
        detached = e.device
        self.logger.info("InterfaceKit %i Detached!" % (detached.getSerialNum()))

    def interfaceKitError(self, e):
        try:
            if e.eCode not in (36866,):
                source = e.device
                self.logger.info("InterfaceKit %i: Phidget Error %i: %s" % (source.getSerialNum(), e.eCode, e.description))
        except PhidgetException as e:
            self.logger.exception(e)

    def interfaceKitInputChanged(self, e):
        input = self.get_input(e.index)
        if not input: return
        val = input.do_conversion(e.value)
        ob = input.json()
        self.publish(ob)
        self.logger.info("%s Input: %s" % (input.display, val))

    def interfaceKitSensorChanged(self, e):
        sensor = self.get_sensor(e.index)
        if not sensor: return
        val = sensor.do_conversion(float(e.value)) if sensor else 0
        ob = sensor.json()
        self.publish(ob)
        self.logger.info("%s Sensor: %s" % (sensor.display, val))

    def interfaceKitOutputChanged(self, e):
        output = self.get_output(e.index)
        if not output: return
        output.current_state = e.state
        ob = output.json()
        self.publish(ob)
        self.logger.info("%s Output: %s" % (output.display, output.current_state))


    def run(self):
        if LIVE: self.init_kit()
        while True: gevent.sleep(.1)

    def init_kit(self):
        try:
            self.interface_kit.setOnAttachHandler(self.inferfaceKitAttached)
            self.interface_kit.setOnDetachHandler(self.interfaceKitDetached)
            self.interface_kit.setOnErrorhandler(self.interfaceKitError)
            self.interface_kit.setOnInputChangeHandler(self.interfaceKitInputChanged)
            self.interface_kit.setOnOutputChangeHandler(self.interfaceKitOutputChanged)
            self.interface_kit.setOnSensorChangeHandler(self.interfaceKitSensorChanged)
        except PhidgetException as e:
            self.logger.exception(e)
            
        self.logger.info("Opening phidget object....")

        try:
            self.interface_kit.openPhidget()
        except PhidgetException as e:
            self.logger.exception(e)
            
        self.logger.info("Waiting for attach....")

        try:
            self.interface_kit.waitForAttach(10000)
        except PhidgetException as e:
            self.logger.exception(e)
            try:
                self.interface_kit.closePhidget()
            except PhidgetException as e:
                self.logger.exception(e)
                self.logger.info("Exiting....")
                exit(1)
            self.logger.info("Exiting....")
        else:
            self.displayDeviceInfo()

        self.logger.info("Initializing Sensors")
        for i in range(self.interface_kit.getSensorCount()):
            try:
                sensor = self.get_sensor(i)
                if sensor:
                    self.logger.info("Setting Up: %s" % sensor.display)
                    self.logger.info("Change: %s" % sensor.change)
                    self.logger.info("Data Rate: %s" % sensor.data_rate)
                    self.interface_kit.setSensorChangeTrigger(i, sensor.change)
                    self.interface_kit.setDataRate(i, sensor.data_rate)
            except PhidgetException as e:
                self.logger.exception(e)
开发者ID:entone,项目名称:Automaton,代码行数:104,代码来源:__init__.py

示例7: interface_kit_output_changed

# 需要导入模块: from Phidgets.Devices.InterfaceKit import InterfaceKit [as 别名]
# 或者: from Phidgets.Devices.InterfaceKit.InterfaceKit import setOnOutputChangeHandler [as 别名]

def interface_kit_output_changed(e):
    source = e.device
    print("InterfaceKit %i: Output %i: %s" % (source.getSerialNum(), e.index, e.state))

# Main Program Code
try:
    # logging example, uncomment to generate a log file
    # interfaceKit.enableLogging(PhidgetLogLevel.PHIDGET_LOG_VERBOSE, "phidgetlog.log")

    interfaceKit.setOnAttachHandler(interface_kit_attached)
    interfaceKit.setOnDetachHandler(interface_kit_detached)
    interfaceKit.setOnErrorhandler(interface_kit_error)
    interfaceKit.setOnInputChangeHandler(interface_kit_input_changed)
    interfaceKit.setOnOutputChangeHandler(interface_kit_sensor_changed)
    interfaceKit.setOnSensorChangeHandler(interface_kit_output_changed)
except PhidgetException as e:
    print("Phidget Exception %i: %s" % (e.code, e.details))
    print("Exiting....")
    exit(1)

print("Opening phidget object....")

try:
    interfaceKit.openRemoteIP('169.254.4.87', 5001, -1, "greenspy")
except PhidgetException as e:
    print("Phidget Exception %i: %s" % (e.code, e.details))
    print("Exiting....")
    exit(1)
开发者ID:jervislam0911,项目名称:GreenSpy,代码行数:31,代码来源:InterfaceKit-simple.py

示例8: SitwPhidgetsKey

# 需要导入模块: from Phidgets.Devices.InterfaceKit import InterfaceKit [as 别名]
# 或者: from Phidgets.Devices.InterfaceKit.InterfaceKit import setOnOutputChangeHandler [as 别名]

#.........这里部分代码省略.........
                
                
    def onDraw(self, dc):                

        strColorPen1 = 'red'
        strColorPen2 = 'blue'
        
        for i in range(sitwPara.KeyCount):
            
            rect = sitwPara.List_ButtonPos[i]
            dc.SetBrush(wx.Brush((0, 255*self.ListValBrt[i], 255*self.ListValBrt[i])))    
            if self.KeyPressed == sitwPara.List_Action[i]:
                dc.SetPen(wx.Pen(strColorPen1, 5))
            else:
                dc.SetPen(wx.Pen(strColorPen2, 1))
                #dc.SetPen(wx.TRANSPARENT_PEN)
            dc.DrawRoundedRectangleRect(rect, 8)
        
        
                
    def initPhidgets(self):
        try:
            self.interfaceKit = InterfaceKit()
        except RuntimeError as e:
            print("Runtime Exception: %s" % e.details)
            print("Exiting....")
            exit(1)
        
        try:
            self.interfaceKit.setOnAttachHandler(self.inferfaceKitAttached)
            self.interfaceKit.setOnDetachHandler(self.interfaceKitDetached)
            self.interfaceKit.setOnErrorhandler(self.interfaceKitError)
            self.interfaceKit.setOnInputChangeHandler(self.interfaceKitInputChanged)
            self.interfaceKit.setOnOutputChangeHandler(self.interfaceKitOutputChanged)
            self.interfaceKit.setOnSensorChangeHandler(self.interfaceKitSensorChanged)
        except PhidgetException as e:
            print("Phidget Exception %i: %s" % (e.code, e.details))
            print("Exiting....")
            exit(1)
        
        print("Opening phidget object....")
        
        try:
            self.interfaceKit.openPhidget()
        except PhidgetException as e:
            print("Phidget Exception %i: %s" % (e.code, e.details))
            print("Exiting....")
            exit(1)
        
        print("Waiting for attach....")
        
        try:
            self.interfaceKit.waitForAttach(10000)
        except PhidgetException as e:
            print("Phidget Exception %i: %s" % (e.code, e.details))
            self.closePhidgets()
        else:
            self.displayDeviceInfo()
        
        
        #get sensor count
        try:
            self.ChannelCount = self.interfaceKit.getSensorCount()
        except PhidgetException as e:
            print("Phidget Exception %i: %s" % (e.code, e.details))
            self.closePhidgets()
开发者ID:screensinthewild,项目名称:Phidgets-Light-Keypad,代码行数:70,代码来源:SitwPhidgetsKey.py

示例9: PHIDGET_IFK

# 需要导入模块: from Phidgets.Devices.InterfaceKit import InterfaceKit [as 别名]
# 或者: from Phidgets.Devices.InterfaceKit.InterfaceKit import setOnOutputChangeHandler [as 别名]
class PHIDGET_IFK(object):
    """ Phidget InterfaceKit """
    def __init__(self, serialNumber=None, waitForAttach=1000, **kargs):

        self.interfaceKit = InterfaceKit()

        if 'remoteHost' in kargs:
            self.interfaceKit.openRemote(kargs['remoteHost'], serialNumber)
        else:
            self.interfaceKit.openPhidget(serialNumber)
    
        self.ratiometric = 1
        if 'ratiometric' in kargs:
            self.ratiometric = kargs['ratiometric'] 

        h = [
            'onAttachHandler',
            'onDetachHandler',
            'onErrorhandler',
            'onInputChangeHandler',
            'onOutputChangeHandler',
            'onSensorChangeHandler'
            ]

        for event in h:
            self.__dict__[event] = None
            if event in kargs:
                self.__dict__[event] = kargs[event]

        self.interfaceKit.setOnAttachHandler(self.attached)
        self.interfaceKit.setOnDetachHandler(self.detached)
        self.interfaceKit.setOnErrorhandler(self.error)
        self.interfaceKit.setOnInputChangeHandler(self.inputChanged)
        self.interfaceKit.setOnOutputChangeHandler(self.outputChanged)
        self.interfaceKit.setOnSensorChangeHandler(self.sensorChanged)


        if waitForAttach > 0:
            try:
                self.interfaceKit.waitForAttach(waitForAttach)
            except PhidgetException as e:
                #print("Phidget Exception %i: %s" % (e.code, e.details))
                try:
                    self.interfaceKit.closePhidget()
                except PhidgetException as e2:
                    pass
                raise e



    def attached(self, e):
        self.interfaceKit.setRatiometric(self.ratiometric)
        time.sleep(0.05)
        if self.onAttachHandler: self.onAttachHandler(e)

    def detached(self, e):
        if self.onDetachHandler: self.onDetachHandler(e)

    def error(self, e):
        error = {'code': e.eCode, 'description': e.description}
        if self.onErrorhandler: self.onErrorhandler(error, e)

    def outputChanged(self, e):
        if self.onInputChangeHandler: self.onInputChangeHandler(e.index, e.state, e)

    def inputChanged(self, e):
        if self.onInputChangeHandler: self.onInputChangeHandler(e.index, e.state, e)

    def sensorChanged(self, e):
        if self.onInputChangeHandler: self.onInputChangeHandler(e.index, e.value, e)
开发者ID:asphotographics,项目名称:WeatherStation,代码行数:72,代码来源:lphidget.py

示例10: main

# 需要导入模块: from Phidgets.Devices.InterfaceKit import InterfaceKit [as 别名]
# 或者: from Phidgets.Devices.InterfaceKit.InterfaceKit import setOnOutputChangeHandler [as 别名]
def main():
    
    
    
    try:
        interfaceKit = InterfaceKit()
    except RuntimeError as e:
        print("Runtime Exception: %s" % e.details)
        print("Exiting....")
        exit(1)

    try:
        interfaceKit.setOnAttachHandler(inferfaceKitAttached)
        interfaceKit.setOnDetachHandler(interfaceKitDetached)
        interfaceKit.setOnErrorhandler(interfaceKitError)
        interfaceKit.setOnInputChangeHandler(interfaceKitInputChanged)
        interfaceKit.setOnOutputChangeHandler(interfaceKitOutputChanged)
        interfaceKit.setOnSensorChangeHandler(interfaceKitSensorChanged)
    except PhidgetException as e:
        print("Phidget Exception %i: %s" % (e.code, e.details))
        print("Exiting....")
        exit(1)

    print("Opening phidget object....")

    try:
        interfaceKit.openPhidget()
    except PhidgetException as e:
        print("Phidget Exception %i: %s" % (e.code, e.details))
        print("Exiting....")
        exit(1)

    print("Waiting for attach....")

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

    print("Setting the data rate for each sensor index to 4ms....")
    for i in range(interfaceKit.getSensorCount()):
        try:
            interfaceKit.setDataRate(i, 4)
        except PhidgetException as e:
            print("Phidget Exception %i: %s" % (e.code, e.details))

    sys.exit(app.exec_())
    try:
        interfaceKit.closePhidget()
    except PhidgetException as e:
        print("Phidget Exception %i: %s" % (e.code, e.details))
        print("Exiting....")
        exit(1)
开发者ID:Dillon-Benson,项目名称:Phidgets-InterfaceKit-Gui,代码行数:63,代码来源:interfaceKit.py


注:本文中的Phidgets.Devices.InterfaceKit.InterfaceKit.setOnOutputChangeHandler方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。