Uploading to multiple devices while altering the main function's variable

Hello, I just learned that I could use the Platform IO to simultaneously upload firmware to several devices.
I’d like to upload the same code while changing a specific variable (like the node address) in the main function at the same time.
For example, I want to upload the same code but change the ‘nodeAddress’ variable’s value to 0x0001 for COM port 1 and 0x0002 for COM port 2.
It seems that by changing some code in the platformio.ini or extra_script.py files, I could do this.
Although I’ve read the details in the below link, but I still need more detailed instructions on how to apply the aforementioned code. (Scripting Examples — PlatformIO latest documentation)
Could you give me some advice on this?

Thank you :slight_smile: