include libraries with esp32

Hi!

I’ve just started using the esp32 with esp-idf and visual studio code. I followed this guide →
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/ and I managed to build and flash the hello world program to the esp32 from the get_started examples. However, I noticed that a few libraries weren’t included in the path when I open them in vs code. I reinstalled it with this script → https://gist.github.com/hexagon5un/cd8a86c32d0da45e2ae214c24957180a from this guide →
hackaday HOW TO GET STARTED WITH THE ESP32 by Elliot Williams.

and it still doesn’t work…

Anyone as any idea on why?

I would also like to add the libraries from arduino but Im not sure how to do that. I did try the arduino extension for vs code but the libraries still aren’t included in the path.

I’m new to this kind of hardware programming and quite confused with the whole setup.

Any kind of help will be highly appreciated! :))

have you tried the arduino IDE?
it is rudimentary but for me having more examples online helped.

i’m developing a solar powered sound device.

2 Likes

Seems like it might be a $PATH file location issue, did you use the hackaday tutorial successfully? Did the reinstall break everything, or was behavior unchanged?
Are you on windows/mac/linux?
Usually I either place the files in the default $PATH location for VS Code, or create a directory specifically for any additional libraries and point VS Code to it.

Are you tied to VS Code, or are you open to other coding environments? The Arduino IDE has a lot of great tools for ESP32 dev, as well as a (rather) user-friendly library and board manager. But if you’re super into using VS Code maybe we can try to figure out getting VS Code to locate the files.

1 Like

Thanks for the replies!!

Im unfortunately not a fan of the arduino ide and would like to be able to use vs code going forward.

Im on linux/ubuntu and have updated the path variables in my ./profile according to the guide on esspressif. Since my first post l’ve also updated the c_cpp_properties.json and compile_commands.json. I tried to update the component.mk but im not sure if i understand how to do that correctly…

However some of the libraries/header files/components(thats what they’re called at esspressif?) were found(!), but not the FreeRTOS.h.

Im guessing if I wanna add libraries in should put them in the components directory?

1 Like

Seems like something worth trying, if the shoe fits…

Perhaps you already know this but PlatformIO includes a library manager. You could use this solution within VScode.

Video tutorial: How To Install PlatformIO (ESP32 + Arduino series) - YouTube

Doc: Espressif 32 — PlatformIO latest documentation

3 Likes

In agreement with @Nordseele and is what I used for my last ESP32 endeavor . It’s all in VisualStudio and the library management features make the Arduino environment really manageable-kind of gets rid of the worst part Arduino IMO which is missing/changed libraries.

I fooled with the ESP-IDF from the espressif extension for VSCode and it worked for me right out of the box. I’m Windows mostly and it just worked-way simpler than the old process. Also had some luck with setting up the build environment on a pi and just using remote ssh in VSCode.

1 Like