本文整理匯總了Python中Arduino.Arduino.__init__方法的典型用法代碼示例。如果您正苦於以下問題:Python Arduino.__init__方法的具體用法?Python Arduino.__init__怎麽用?Python Arduino.__init__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Arduino.Arduino
的用法示例。
在下文中一共展示了Arduino.__init__方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from Arduino import Arduino [as 別名]
# 或者: from Arduino.Arduino import __init__ [as 別名]
def __init__(self,valveP=6,valveS1=2,valveS2=3,valveS3=4,valveS4=5,pump1D=8,pump1S=9,pump2D=12,pump2S=11):#the defaults are the pins that I assume will be connected to the valves
try:
Arduino.__init__(self) #connect to arduino REMOVE THE PORT!!
except ValueError:
logging.warning('Error! Arduino was not found')
return
self.valveP=valveP
self.valveS1=valveS1
self.valveS2=valveS2
self.valveS3=valveS3
self.valveS4=valveS4#
self.valveList=[self.valveP,self.valveS1,self.valveS2,self.valveS3,self.valveS4]
self.pump1D=pump1D#
self.pump1S=pump1S
self.pump2D=pump2D
self.pump2S=pump2S
self.pinMode(self.valveP,'Output')#
self.digitalWrite(self.valveP,'HIGH')
self.pinMode(self.valveS1,'Output')
self.digitalWrite(self.valveS1,'HIGH')
self.pinMode(self.valveS2,'Output')
self.digitalWrite(self.valveS2,'HIGH')
self.pinMode(self.valveS3,'Output')
self.digitalWrite(self.valveS3,'HIGH')
self.pinMode(self.valveS4,'Output')
self.digitalWrite(self.valveS4,'HIGH')
self.pinMode(self.pump1D,'Output')#
self.pinMode(self.pump1S,'Output')
self.pinMode(self.pump2D,'Output')
self.pinMode(self.pump2S,'Output')
示例2: __init__
# 需要導入模塊: from Arduino import Arduino [as 別名]
# 或者: from Arduino.Arduino import __init__ [as 別名]
def __init__(self, *args, **kwargs):
Thread.__init__(self)
Arduino.__init__(self, *args, **kwargs)
self.lock = Lock()
self._kill = False
self.start()