How to use Multiple board in single project

Hi I am new to PlatformIO IDE and using it for ESP32 IOT device. I like to understand if there are ways for me to connect two boards simultaneously and build with same project source with two different compile option and send respective build binaries to device connected on different COM port. I assume there is a way but I am new to it

Context: I have two identical ESP32 devices and I want to use one device to transmit the data and other device to receive the data. I wonder in Platform.ini etc I can build two target binary and flash one to device connected to COMx port and other binary to device connected to COMy port

Generally what is the best way to use the common source code and build & flash multiple binary to different target device. Should I do multiple compile etc by switching default_envs and recompiling


Create two environments with their upload_port and monitor_port being set their respective board’s COM port.

Hi, I’ve a similar question…
in this case, the program can also be different and I can specify for example
main1-> ESP1 on COM1 & main2 -> ESP2 on COM12
or the software must be the same?


You can use build_src_filter to filter the built source files for each environment. So you could have src/program_1/<all source files> and src/program_2/<all source files> with build_src_filter = +<program_1> and build_src_filter = +<program_2> respectively.

But at this point, you can also just use two different projects…

thanks for the super fast reply!!