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


Python PCF8591.setup方法代码示例

本文整理汇总了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, ())
开发者ID:hscasn,项目名称:Greenhouse-Controller-Prototype,代码行数:37,代码来源:main.py

示例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)
开发者ID:haloteam,项目名称:halo,代码行数:29,代码来源:Halo.py

示例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
开发者ID:jliamfinnie,项目名称:iot-disaster,代码行数:12,代码来源:rainSensor.py

示例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)
开发者ID:haloteam,项目名称:halo,代码行数:14,代码来源:run.py

示例5: setup

# 需要导入模块: import PCF8591 [as 别名]
# 或者: from PCF8591 import setup [as 别名]
def setup():
	ADC.setup(0x48)
开发者ID:Emilleopold,项目名称:Sunfounder_37_Sensor_Kit_V2.0_for_RasPi,代码行数:4,代码来源:19_sound_sensor.py

示例6: setup

# 需要导入模块: import PCF8591 [as 别名]
# 或者: from PCF8591 import setup [as 别名]
def setup():
	ADC.setup(0x48)
	GPIO.setup(DO, GPIO.IN)
开发者ID:haloteam,项目名称:halo,代码行数:5,代码来源:18_thermistor.py

示例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)
开发者ID:Emilleopold,项目名称:Sunfounder_37_Sensor_Kit_V2.0_for_RasPi,代码行数:7,代码来源:22_gas_sensor.py

示例8: setup

# 需要导入模块: import PCF8591 [as 别名]
# 或者: from PCF8591 import setup [as 别名]
def setup():
	print 'Setting up, please wait...'
	ADC.setup(0x48)
开发者ID:BadassHomesteader,项目名称:BeeBot,代码行数:5,代码来源:BeeBot1.2.py

示例9: setup

# 需要导入模块: import PCF8591 [as 别名]
# 或者: from PCF8591 import setup [as 别名]
def setup():
    GPIO.setmode(GPIO.BCM)
    ADC.setup(0x48)
    GPIO.setup(DO, GPIO.IN)
开发者ID:icdeadpll,项目名称:CIT480DisasterBOT,代码行数:6,代码来源:gas_sensor_control.py

示例10: setup

# 需要导入模块: import PCF8591 [as 别名]
# 或者: from PCF8591 import setup [as 别名]
def setup():
	ADC.setup(0x48)					# Setup PCF8591
	global state
开发者ID:Emilleopold,项目名称:Sunfounder_37_Sensor_Kit_V2.0_for_RasPi,代码行数:5,代码来源:15_joystick_PS2.py


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