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

[env:esp32dev]
platform = GitHub - platformio/platform-espressif32: Espressif 32: development platform for PlatformIO
board = esp32dev
framework = arduino
upload_port=192.168.1.77
lib_deps=
GitHub - blynkkk/blynk-library: Blynk library for embedded hardware. Works with Arduino, ESP8266, Raspberry Pi, Intel Edison/Galileo, LinkIt ONE, Particle Core/Photon, Energia, ARM mbed, etc.
GitHub - adafruit/Adafruit_Sensor: Common sensor library

https://github.com/adafruit/Adafruit 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:

lib_deps=
Blynk
Adafruit Unified Sensor
DHT sensor library

or:

lib_deps=
GitHub - blynkkk/blynk-library: Blynk library for embedded hardware. Works with Arduino, ESP8266, Raspberry Pi, Intel Edison/Galileo, LinkIt ONE, Particle Core/Photon, Energia, ARM mbed, etc.
GitHub - adafruit/Adafruit_Sensor: Common sensor library
GitHub - adafruit/DHT-sensor-library: Arduino library for DHT11, DHT22, etc Temperature & Humidity Sensors

1 Like

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: Redirecting...

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

2 Likes