本文整理汇总了Python中PCF8591.setup方法的典型用法代码示例。如果您正苦于以下问题:Python PCF8591.setup方法的具体用法?Python PCF8591.setup怎么用?Python PCF8591.setup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PCF8591
的用法示例。
在下文中一共展示了PCF8591.setup方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup
# 需要导入模块: import PCF8591 [as 别名]
# 或者: from PCF8591 import setup [as 别名]
def setup():
global CURRENT_DAY
global CURRENT_MON
global CURRENT_HOUR
global CROP
global SYSTEM_CONTROLLER
GPIO.setmode(GPIO.BOARD)
GPIO.setup(RAIN_SENSOR_PIN, GPIO.IN)
ADC.setup(0x48)
global TEMPERATURE_SENSOR
for i in os.listdir('/sys/bus/w1/devices'):
if i != 'w1-bus-master1':
TEMPERATURE_SENSOR = i
print('== Program starting ==')
GPIO.setup(FAN_PIN, GPIO.OUT)
GPIO.setup(ROOF_PIN, GPIO.OUT)
GPIO.setup(HEAT_PIN, GPIO.OUT)
GPIO.setup(WATER_PIN, GPIO.OUT)
GPIO.setup(SHADE_PIN, GPIO.OUT)
GPIO.setup(BLACKOUT_PIN, GPIO.OUT)
GPIO.setup(LIGHT_PIN, GPIO.OUT)
CURRENT_DAY = datetime.datetime.today().day
CURRENT_MON = datetime.datetime.today().month
CURRENT_HOUR = datetime.datetime.today().hour
CROP = Crop('plant.csv')
SYSTEM_CONTROLLER = SystemController(SYSTEM_PINS, GPIO)
# Starting thread for user input
thread.start_new_thread(listen_for_input, ())
示例2: setup
# 需要导入模块: import PCF8591 [as 别名]
# 或者: from PCF8591 import setup [as 别名]
def setup(self):
GPIO.setmode(GPIO.BCM)
ADC.setup(0x48)
LCD.init(0x27, 1)
self.display_text("System startup")
# setup pins for sensors
GPIO.setup(self.THERMISTOR_PIN, GPIO.IN)
GPIO.setup(self.GAS_SENSOR_PIN, GPIO.IN)
GPIO.setup(self.BUZZ_PIN, GPIO.OUT)
GPIO.setup(self.H2O_PIN, GPIO.IN)
# setup pins for "eyes"
# first eye
GPIO.setup(self.SDI_0, GPIO.OUT)
GPIO.setup(self.RCLK_0, GPIO.OUT)
GPIO.setup(self.SRCLK_0, GPIO.OUT)
GPIO.output(self.SDI_0, GPIO.LOW)
GPIO.output(self.RCLK_0, GPIO.LOW)
GPIO.output(self.SRCLK_0, GPIO.LOW)
# second eye
GPIO.setup(self.SDI_1, GPIO.OUT)
GPIO.setup(self.RCLK_1, GPIO.OUT)
GPIO.setup(self.SRCLK_1, GPIO.OUT)
GPIO.output(self.SDI_1, GPIO.LOW)
GPIO.output(self.RCLK_1, GPIO.LOW)
GPIO.output(self.SRCLK_1, GPIO.LOW)
示例3: setup
# 需要导入模块: import PCF8591 [as 别名]
# 或者: from PCF8591 import setup [as 别名]
def setup(gpioPort, i2cAddress):
global initialRainIntensityReading
global lowerBoundary
GPIO.setmode(GPIO.BCM)
ADC.setup(i2cAddress)
GPIO.setup(gpioPort, GPIO.IN)
initialRainIntensityReading = ADC.read(0)
# set the delta zone so we dont need to recalc it every time
lowerBoundary = initialRainIntensityReading - rainDelta
print "initial rain intensity reading: ", initialRainIntensityReading
示例4: setup
# 需要导入模块: import PCF8591 [as 别名]
# 或者: from PCF8591 import setup [as 别名]
def setup():
ADC.setup(0x48)
LCD.init(0x27, 1)
LCD.write(0,0,'System startup...')
time.sleep(1)
ALARM = False
LCD.clear()
GPIO.setup(THERMISTOR_PIN, GPIO.IN)
GPIO.setup(GAS_SENSOR_PIN, GPIO.IN)
GPIO.setup(BUZZ_PIN, GPIO.OUT)
GPIO.setup(H2O_PIN, GPIO.OUT)
GPIO.output(BUZZ_PIN, GPIO.HIGH)
示例5: setup
# 需要导入模块: import PCF8591 [as 别名]
# 或者: from PCF8591 import setup [as 别名]
def setup():
ADC.setup(0x48)
示例6: setup
# 需要导入模块: import PCF8591 [as 别名]
# 或者: from PCF8591 import setup [as 别名]
def setup():
ADC.setup(0x48)
GPIO.setup(DO, GPIO.IN)
示例7: setup
# 需要导入模块: import PCF8591 [as 别名]
# 或者: from PCF8591 import setup [as 别名]
def setup():
ADC.setup(0x48)
GPIO.setup (DO, GPIO.IN)
GPIO.setup (Buzz, GPIO.OUT)
GPIO.output (Buzz, 1)
示例8: setup
# 需要导入模块: import PCF8591 [as 别名]
# 或者: from PCF8591 import setup [as 别名]
def setup():
print 'Setting up, please wait...'
ADC.setup(0x48)
示例9: setup
# 需要导入模块: import PCF8591 [as 别名]
# 或者: from PCF8591 import setup [as 别名]
def setup():
GPIO.setmode(GPIO.BCM)
ADC.setup(0x48)
GPIO.setup(DO, GPIO.IN)
示例10: setup
# 需要导入模块: import PCF8591 [as 别名]
# 或者: from PCF8591 import setup [as 别名]
def setup():
ADC.setup(0x48) # Setup PCF8591
global state