Setting up external library for raspberry pi pico, with visual studio

Viewed 38

so I have my PI Pico set up for use with C++, and has been working great. However I am not great at environment set up and am new to visual studio.

So I am trying to use this library https://github.com/cristiancristea00/Pico-I2C-LCD

But I am just struggling to understand the readme file for setting this up, I tried using the developer command prompt for VS and normal command prompt run as administrator, but when I run the first command.

"export PICO_SDK_PATH='/Path/to/SDK' it says:

"recognized as an internal or external command, operable program or batch file."

So overall, if someone could please explain where I type these commands that are in the readme, and what to type for the cmake command, I would really appreciate it.

Thanks in advance.

Dean

1 Answers

After sitting with this for a while, and after the suggestion from @PMF, what needed to be done was download the library, then add the .cpp and .hpp files into the explorer by dragging and dropping or right clicking and adding from wherever you saved them.

After this you then need to go to the CMakeLists.txt file and in the add_executable function, ensure you add the .cpp and .hpp file names with there extention type, e.g test.cpp or test.hpp, and obviously your own .cpp file. Also ensure the harware_i2c is included in the target_link_libraries function.

Now along with the rest of the standard CMakeLists.txt stuff, you can save and close the this file.

Now in the .cpp file where you want to use the library do #include "LCD_I2C.hpp".

To get the LCD to fully work, go to the github page and copy the example and paste into your .cpp file, but change the #include "../../LCD_I2C.hpp" to #include "LCD_I2C.hpp".

This should now fully work and you can change what is in the while loop to display whatever you want :), thanks to all of those who helped when I posted the initial question.

Related