温湿度センサDHT22の出力NaNエラーへの対応。
https://github.com/adafruit/DHT-sensor-library/issues/48
https://github.com/adafruit/DHT-sensor-library/issues/94
DHT-sensor-libraryのDHT.h line156-160の箇所を以下のように修正します。
DHTセンサ出力シーケンスとESPピン設定シーケンスとの干渉による不具合。
// End the start signal by setting data line high for 40 microseconds.
//digitalWrite(_pin, HIGH);
//delayMicroseconds(40);
// Now start reading the data line to get the value from the DHT sensor.
pinMode(_pin, INPUT_PULLUP);
delayMicroseconds(10); // Delay a bit to let sensor pull data line low.ここは任意10-50。
センサの動作電圧:3.3-6.0Vであり、3.3V未満になると出力が不安定になります。
また読み取り時間は2秒以上を目安とすること。