本文整理匯總了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