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


Python Adafruit_DHT.DHT11属性代码示例

本文整理汇总了Python中Adafruit_DHT.DHT11属性的典型用法代码示例。如果您正苦于以下问题:Python Adafruit_DHT.DHT11属性的具体用法?Python Adafruit_DHT.DHT11怎么用?Python Adafruit_DHT.DHT11使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在Adafruit_DHT的用法示例。


在下文中一共展示了Adafruit_DHT.DHT11属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: collect_temperature

# 需要导入模块: import Adafruit_DHT [as 别名]
# 或者: from Adafruit_DHT import DHT11 [as 别名]
def collect_temperature():    
    humidity, temperature = Adafruit_DHT.read_retry(sensor_temperature, channel_temperature)
    logger.info("humidity: {} temperature: {}".format(humidity, temperature))
    if humidity is not None and temperature is not None:
        return humidity, temperature
    logger.error("Falha ao ler dados do DHT11")
    return 0, 0
    

#GPIO.add_event_detect(channel, GPIO.BOTH)
#GPIO.add_event_callback(channel, collect_moisture) 
开发者ID:aws-samples,项目名称:aws-builders-fair-projects,代码行数:13,代码来源:moistureHandler.py

示例2: webform_load

# 需要导入模块: import Adafruit_DHT [as 别名]
# 或者: from Adafruit_DHT import DHT11 [as 别名]
def webform_load(self): # create html page for settings
  choice1 = self.taskdevicepluginconfig[0]
  options = ["DHT11","DHT22/AM2302"]
  optionvalues = [DHT.DHT11,DHT.DHT22]
  webserver.addFormSelector("Sensor type","plugin_005_type",2,options,optionvalues,None,int(choice1))
  webserver.addFormCheckBox("Oversampling","plugin_005_over",self.timer2s)
  webserver.addFormNote("Strongly recommended to enable oversampling for reliable readings!")
  return True 
开发者ID:enesbcs,项目名称:rpieasy,代码行数:10,代码来源:_P005_DHT.py

示例3: init_sensor

# 需要导入模块: import Adafruit_DHT [as 别名]
# 或者: from Adafruit_DHT import DHT11 [as 别名]
def init_sensor(self):
		#Initialize the sensor here (i.e. set pin mode, get addresses, etc) this gets called by the worker
		sensor_types = { '11': Adafruit_DHT.DHT11,
						'22': Adafruit_DHT.DHT22,
						'2302': Adafruit_DHT.AM2302 }
		if self.type in sensor_types:
			self.sensor = sensor_types[self.type]
		else:
			print('Sensor Model Error: Defaulting to DHT11')
			self.sensor = Adafruit_DHT.DHT11
		return 
开发者ID:mudpi,项目名称:mudpi-core,代码行数:13,代码来源:humidity_sensor.py

示例4: collect_moisture

# 需要导入模块: import Adafruit_DHT [as 别名]
# 或者: from Adafruit_DHT import DHT11 [as 别名]
def collect_moisture(channel):
    # Efetua a leitura do sensor
    umid, temp = 0,0
    #umid, temp = Adafruit_DHT.read_retry(sensor, 4)    
    # Caso leitura esteja ok, mostra os valores na tela
    if umid is not None and temp is not None:
        print ("Temperatura = {0:0.1f}  Umidade = {1:0.1f}n").format(temp, umid)
        print ("Aguarda 5 segundos para efetuar nova leitura...n")
        publishTemperature(temp, umid)
    else:
        # Mensagem de erro de comunicacao com o sensor
        print("Falha ao ler dados do DHT11 !!!")

#GPIO.add_event_detect(channel, GPIO.BOTH)
#GPIO.add_event_callback(channel, collect_moisture) 
开发者ID:aws-samples,项目名称:aws-builders-fair-projects,代码行数:17,代码来源:temperatureHandler.py


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