I am doing my first project using "NodeMCU ESP8266" & "DHT11 Temperature and Humidity Sensor Module" and trying to read temperature and humidity. However, I while trying to read the temperature I get the below result,
Info: I have never made any schematics in the past, so I am not sure how to include the USB Port there in the diagram but the NodeMCU comes up with Micro USB Port and I have connected that to a PC. Apologies if I have missed out any important detail.
Defining DHTpin as 2 means GPIO2, which is D4. Defining it as D2 means GPIO4, which, if you look on the underside of your NodeMCU, you will likely find is the pin you are using.
The NAN error may occur due to loose connection too. Please check your wiring. If nothing solves the problem, you can try any other library. You can also cross-check your setup with this tutorial:
resolved the issue. Thank you so much. But I am not able to understand, how the pin number can be identified? The only way to check for the pin numbering is from the data sheet right?