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


Python Channel.stop方法代碼示例

本文整理匯總了Python中channel.Channel.stop方法的典型用法代碼示例。如果您正苦於以下問題:Python Channel.stop方法的具體用法?Python Channel.stop怎麽用?Python Channel.stop使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在channel.Channel的用法示例。


在下文中一共展示了Channel.stop方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from channel import Channel [as 別名]
# 或者: from channel.Channel import stop [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.stop方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。