Skip to content
Advertisement

unable to set line to input

I am trying to read humidity and temperature values from the AM2301(DHT21). for that I am using the adafruit_dht library which is written for DHT11 & DHT22. because I can’t find any adafruit library for AM2301 so I use this.
when I first run the code using some gpio say D17. it works fine and gives the temperature and humidity values but when I run that program again I get this error unable to set line 24 to input but when I change the pin it solves the problem temporarily for the first time and then it causes the same error.
a lot many people ask this question, and I have tried their solutions but nothing works.

JavaScript

Output:
enter image description here

Advertisement

Answer

I found a solution, by writing use_pulseio=False solves the problem:

JavaScript

pulseio module contains classes to provide access to basic pulse IO. Individual pulses are commonly used in infrared remotes and in DHT temperature sensors.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement