PlatformIO Community

Working on arduino libraries


#1

hello,

I am new to platformio, I need to use it for an arduino library I am working on. I was wondering which is the best way to work on an arduino project/library because the platformio structure differ a lot to the arduino library
example of an arduino lib:
├───examples
│ ├───advanced_working
│ └───basic_working
├───extras
│ └───…
└───src

Where the source code are in ‘src’ and in examples there are some .ino sketches

What do you suggest me to have a clean as possible folder structure as the arduinio one? i need it because I am pubblishing it to github and to the arduino library manager


#2

After a lot of googling i found how to procede, i will write a short guide in the case someone will have the same problem:

  1. go to the root folder (where there is the library.properties file) of the library which you want to develop and run pio init
  2. Open Project with your favourite ide
  3. in platformio.ini write:
    [platformio]
    src_dir = examples/your_sketch_name
    lib_dir = src ;yes it appear to be wrong but is right
  4. enjoy platformio!

I also opened a issue on the docs repo https://github.com/platformio/platformio-docs/issues/46 hoping @ivankravets or @valeros would see it