0

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

Dean
  • 11
  • 4
  • The instructions there are for linux. They can't be mapped 1:1 to building with visual studio. – PMF Sep 16 '22 at 12:21
  • Since the library consists of only one cpp + .h file, the easiest probably is to just include it in the build of your main program. – PMF Sep 16 '22 at 12:22
  • Do you know how to do this in visual studio, or have a good link for this. Thanks, Dean – Dean Sep 16 '22 at 12:25
  • Unfortunately, I do not have a pi-pico and have never built for it, so I do not even know the "standard" build procedure for it. For the microcontrollers I have used so far (Arduino, ESP32, and others), this only works with special extensions to Visual Studio. You should first understand the recommended way of building C++ for the pi-pico. – PMF Sep 16 '22 at 12:28
  • @PMF thanks for the help, I do know the standard way of building c++ projects for the pico, using the Pico SDK you just include what you need in the MakeLists.txt file. But seems to be different for external library outside of the Pico SDK – Dean Sep 16 '22 at 12:40

1 Answers1

0

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.

Dean
  • 11
  • 4