Connected devices

Let’s start with two pin diagrams

ESP8266 NodeMCU This is used hereGND, 3V3, D4

There are two kinds of DHT11, the one with the base plate is 3 pins, the one without the base plate is 4 pins, and one of the 4 pins is not connected.



Another wiring diagram

Same thing with the four pins. Same thing with my wiring diagram

run

[MicroPython official website] Use the serial port tool to send the following messages in sequence:

For example, if you want to keep track of the idity of your health, you can keep track of the idity of your health. For example, if you want to keep track of your health, you can keep track of your idity.Copy the code



Failure is success.

Hit a pit here. Executed.measure()I made a mistake

>>> d.measure()

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

  File "dht.py", line 17, in measure

OSError: [Errno 110] ETIMEDOUT
Copy the code

Because if you look at the first picture, the D4 pin corresponds to GPIO2, which should be Pin2.