PlatformIO Community

Problem with DHT.h


Very new to using platformio, trying to use the DHT 22 sensor with a standard ESP 32 development board.
I have tried to include all the library files but I’m getting one error as below:
#include <Arduino.h>
#include <WiFi.h>
#include <ESPmDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>
#include <Wire.h>
#include <Adafruit_BMP280.h>
#include <DTH.h>
when you try and hover over the statement it reads DHT.h no such file or directory
I tried adding the file into the platformio.ini

platform =
board = esp32dev
framework = arduino
lib_deps= DHT Unified

I must be doing something very obviously wrong but I just do not know what
can anyone help please?
PS the same library and the same board and code works fine on the Arduino IDE but I really would like to continue using your new platformio.


Try to make the library reference list in platformio.ini to look as:

Adafruit Unified Sensor
DHT sensor library



DHT Library reports 'nan'

Thank you for taking the time to reply and yes that does now work.
But if you have the time please can you explain simply how you got that answer.
As I’m sure it will come up again and I would like to learn.
Thanking you all again for any advice or suggestions you can offer


Based on my experience with a project where I’m using Adafruit’s generic DHT sensor library approach to support the DHT22 sensor I learned I have to use the two libraries:

The platformio.ini manual page shows how library dependencies can be configured for your project:

Using the library search results show you how to integrate the libraries into the platformio.ini file (see the installation tab):