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


Python Channel.chopperVerre方法代码示例

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


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

示例1: __init__

# 需要导入模块: from channel import Channel [as 别名]
# 或者: from channel.Channel import chopperVerre [as 别名]
class Processor:
    def __init__(self, host, port):
        self.sock = socket.socket()
        self.sock.connect((HOST, PORT+5))
        self.asserv_file = self.sock.makefile(mode='rw')
        self.asserv = Channel(self.asserv_file.buffer,
                lambda name, args: name, proto = 'asserv')
        self.states = None
        self.speed = SpeedOrder(self.asserv)
        self.speed.start()
        self.sock2 = socket.socket()
        self.sock2.connect((HOST, PORT+6))
        self.mother_file = self.sock2.makefile(mode='rw')
        self.mother = Channel(self.mother_file.buffer,
                lambda name, args: name, proto = 'mother')

    def event(self, axes, buttons):
        #print(axes, buttons)
        self.pince = axes[2] < 0
        self.speed.update(axes[0], axes[1], axes[2])
        if self.states and len(self.states) == len(buttons):
            for i in range(len(buttons)):
                if self.states[i] == 0 and buttons[i] == 1:
                    #print("Button %d pressed!" %i)
                    if self.pince:
                        if i == 2:
                            self.mother.sortirPince()
                        elif i == 3:
                            self.mother.getNombreVerres()
                        elif i == 0:
                            self.mother.chopperVerre()
                        elif i == 1:
                            self.mother.lacherVerres()
                    else:
                        if i == 2:
                            self.mother.BougiesOn()
                        elif i == 3:
                            self.mother.BougiesOff()
                        elif i == 0:
                            self.mother.BougiesHitBot()
                        elif i == 1:
                            self.mother.BougiesHitTop()
                    if i == 4:
                        self.mother.startAX12()
                    elif i == 5:
                        self.mother.FunnyAction()
                    elif i == 6:
                        self.mother.stopAX12()
                    elif i == 7:
                        self.asserv.stop()
        self.states = buttons
开发者ID:7Robot-Soft,项目名称:jsbot,代码行数:53,代码来源:jsbot.py


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