2090 views|1 replies

85

Posts

0

Resources
The OP
 

Zero Knowledge Open Source Sharing - Use of Temperature and Humidity Module DHT11 [Copy link]

1. Description MCU: Zero-knowledge open source development board - standard board Module: DHT11 module Development tools: Zero-knowledge open source development tools The DHT11 module is a single bus interface, which is very simple to use. It is powered by 3.3-5V and can be used directly on the Zero Knowledge Laboratory platform. The wiring is shown below. Connect the OUT pin of the module to the A0 pin of the Zero Knowledge standard board. 2. Test After the corresponding connections are connected, just open the Zero Knowledge open source development tool to find the corresponding code, upload the program and open the debug window to see the debugging results. 3. Core code
  1. // DHT11 temperature and humidity sensor demo#include "dht11.h" //Use DHT11 DHT sensor; void setup() { Serial.begin(9600); //Use A0 pin to connect to the output pin of DHT11 modulesensor.attach(A0); delay(1000); } void loop() { //Start to get temperature and humidity datasensor.update(); switch (sensor.getLastError()) { case DHT_ERROR_OK: char msg[128]; //Format output sprintf(msg, "Temperature = %dC, Humidity = %d%%", sensor.getTemperatureInt(), sensor.getHumidityInt()); Serial.println(msg); break; case DHT_ERROR_START_FAILED_1: Serial.println("Error: start failed (stage 1) "); break; case DHT_ERROR_START_FAILED_2: Serial.println("Error: start failed (stage 2)"); break; case DHT_ERROR_READ_TIMEOUT: Serial.println("Error: read timeout"); break; case DHT_ERROR_CHECKSUM_FAILURE: Serial.println("Error: checksum error"); break; } delay(2000);
复制代码
The complete project and more detailed information can be obtained for free on the official website of Zero Knowledge Lab. This content is originally created by EEWORLD forum user roc2. If you want to reprint or use it for commercial purposes, you must obtain the author's consent and indicate the source


开发工具界面.png (83.95 KB, downloads: 0)

开发工具界面.png
This post is from DIY/Open Source Hardware

Latest reply

ok   Details Published on 2020-3-14 17:16
 

2

Posts

0

Resources
2
 

ok

This post is from DIY/Open Source Hardware
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list