M5stick from PlatformIO



  • Hi

    Having problems with UIFlow, I tried PlatformIO to program the M5stick.
    I was able to upload the "arduino-wifiscan" but then I wanted to print Wifi infos on the screen. I thought I had to #include <M5StickC.h> but it "gets red" and says I should update includePath
    Why/how do I do that ?
    I tried "pio lib install "M5StickC" and no more red alert...for a while, but then error again about includePath
    If someone had a simple step by step setup for the M5StickC it would help me a lot...



  • You need to change your lib_deps in platformio.ini, as the sample bellow:

    [env:m5stick-c]
    platform = espressif32
    board = m5stick-c
    framework = arduino
    lib_deps = M5StickC
    monitor_speed = 115200
    


  • Another simple solution is to download the library and put all files from the /src directory directly it in the /src directory from your PlatformIO project.

    Link to the library:
    https://github.com/m5stack/M5StickC

    Then you can include the header file like this:
    #include "M5StickC.h"

    Not exactly the most beautiful solution, but it works...



  • @hague I could be wrong, but I believe if you use as lib_deps is a better solution, because the PlatformIO can update automatically the library in the future. Not only that, your code build more faster (because the library use a shared objects - *.o files).

    Other interesting point is to add more libraries to project. But again, this is IMHO about the way to use PlatformIO.