How to reference a place inside the project folder to the file arduino_pins.h


We have a board based with an ATMEGA32U4 based on the Arduino Leonardo board. We needed to change some pin assignments, so We created a new Json file describing this new board. Our problem is the reference to the custom file pins_arduino.h in the line “variant”: ". It is only working if I pass the complete path of the folder, including “/home/user/projectpath…”, in this line. In this way, the code will not work on other user/computer. How to reference this file to some place inside the project?

Thank you in advance.

You can make PR to:

Thank you, Ivan.

I know that, but I am doing this board to attend a specific application I am dealing now that I need to change the pin assignment of the Leonardo board. I don’t want to turn it public or commercial. So, I don’t see the necessity to make it part of the official Platformio board tree. So I would like the reference to arduino_pins.h to be internal to the project.


Could you try to place arduino_pins.h to inc folder inside a project?

The problem is that PlatformIO doesn’t recognize the ‘~’ as your home directory. Using “~/projectpath…” should work, but there is a bug.

If it gets fixed that would solve your problem.

lib_extra_dirs = ~/Documents/Arduino/libraries <------ doesn’t work BUG
lib_extra_dirs = C:/Users/je/Documents/Arduino/libraries <----- finds the dir, but absolute PLEASE FIX

Fixed in Expand user folder for `lib_extra_dirs` · platformio/platformio-core@71afea8 · GitHub

Please open PlatformIO IDE Terminal, type pio upgrade. Now it should work.

I tried to put the file inside the project/inc folder. But, What do I put in the line variants of the json file? Just inc doesn’t work, /inc as well.

Do you mean that it doesn’t work without inc/prefix?