當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。