PlatformIO Community

Developing multiple .ino files

Hello, I have integrated my Arduino project into PlatformIO.
I would like to develop multiple version of the .ino files in the src folder.
What’s the best practice in doing so?

I had to write another version of the code in a text file and copy and replace it into the .ino file if I’m working on multiple functionalities at the same time…

You can create multiple environments ([env:x], [env:y]) in the platformio.ini and give each of them a build_src_filter that excludes all but the wanted file (-<*> +<targetfile.ino> +<targetfile.cpp>).

I find that a Makefile helps to select targets in the same .ino file…

# Makefile
# type "make -s" to list options

BRD    := megaatmega2560xd
BRD    := nodemcuv2
BRD    := esp32dev
BRD    := featheresp32

VDATE  := 2022.apr.28

all:
	echo "make s1 .. (init/update the project)\n"
	echo "make s2 .. (compile the project for errors)\n"
	echo "make s3 .. (compile and upload the project)\n"
	echo "make clean .. (delete the object files from build)\n"

s1:
	pio project init -b ${BRD}

s2:
	pio run -e ${BRD}

s3:
	pio run -e ${BRD} --target upload

clean:
	pio run -t clean