本文整理汇总了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()