QtCreator + PlatformIO + Arduino Library question

Hello.

I have started a fresh Qt Creator Arduino project. I have it building and uploading just fine.

I wanted to add a DHT11 temp sensor lib and did by running this command:

jurisl@yuriylinuxpc:~/ard3$ platformio lib install 18

I can see it is building with the project here:

But I can’t figure out how to use it in my project? It does not show up in #include <dh…

Please advise.

Please explain in details.

As explained above, I do the following steps:

  1. Start a fresh Qt Creator - PIO project
  2. Add a lib to it: platformio lib install 18
  3. While building, I can see it being built (image above)

How do I start using it now? There is no .h file when I am trying to include dht11.h
When I try create DHT object, it is not found.

What else am I missing ?

PlatformIO installed a library in a project’s isolated storage. Just include header and PlatformIO will find library automatically. See example PlatformIO Registry

Thanks for the example. It is very useful.

The problem I have is:

  1. I install the library with this command: platformio lib install 18

I see this output, telling me it is already installed:

Library Storage: /home/jurisl/ard3/.piolibdeps
LibraryManager: Installing id=18
Adafruit DHT Unified @ 1.0.0 is already installed
Installing dependencies
Looking for Adafruit Unified Sensor library in registry
Found: PlatformIO Registry Unified Sensor
LibraryManager: Installing id=31
Adafruit Unified Sensor @ 1.0.2 is already installed
Looking for DHT sensor library library in registry
Found: PlatformIO Registry sensor library
LibraryManager: Installing id=19
DHT sensor library @ 1.3.0 is already installed
Installing dependencies
Looking for Adafruit Unified Sensor library in registry
Found: PlatformIO Registry Unified Sensor

  1. I try including it into my Qt project main.cpp file, but DHT11.h or Adafruit_Sensor.h headers are not found.

  2. I have looked in here: /home/jurisl/.platformio/packages/framework-arduinoavr/libraries/

  3. I also did this:

jurisl@yuriylinuxpc:~/ard3$ platformio lib update
Library Storage: /home/jurisl/ard3/.piolibdeps
Updating Adafruit DHT Unified @ 1.0.0 [Up-to-date]
Updating Adafruit Unified Sensor @ 1.0.2 [Up-to-date]
Updating DHT sensor library @ 1.3.0 [Up-to-date]
Updating DHT11 @ b7fbbcd86f [Up-to-date]
Updating DHT @ 1.0.0 [Up-to-date]
Updating I2Cdevlib-Core @ 615f132009 [Up-to-date]

And this lib is not there. What can be the problem ?

Hmmm… I actually found lib folders here:

Do I have to add them to my platformio.pro file by hand ?
Like that:

INCLUDEPATH += “$${HOMEDIR}/.platformio/lib/Adafruit Unified Sensor_ID31”
INCLUDEPATH += “$${HOMEDIR}/.platformio/lib/DHT sensor library_ID19s”

Please read all warning and notes from Redirecting...

Warning! The libraries which are added, installed or used in the project after generating process wont be reflected in IDE. To fix it you need to reinitialize project using platformio init (repeat it).