Note that the [env:xyz] sections can be left empty.
It’s by far the simplest way I’ve found so far to keep a collection of little test & demo apps in a single place, all compiled in the same way and using the same library code. A quick check that all the apps compile is a matter of typing pio run.
To build and upload say the blink app, type: pio run -t upload -e blink - easy!
(and if you define alias prue='pio run -t upload -e', then this becomes prue blink)
Where are you typing the commands at in VSCode? For me, typing pio into the terminal, set to a PlatformIO CLI, I get the standard list of commands help menu printed. Typing in pio env results in a Error: No such command "env"
Looking for a way to mimic Arduino library folder, allowing me to work on code in ‘examples’ folder while still being able to work on the library itself.
Lovely, thanks! Last question - is there a way to use other variables in +<main-${PIOENV}.cpp>? Could I set e.g. SRCNAME=default in the default env, use +<main-${SRCNAME}.cpp> in the src_filter, and then have some environments that default to main-default.cpp, but allow others to set a new value, e.g.
@jcw This is an awesome find; it is a big time saver. With all the connectivity (ble, wifi, lora) it is rare to have a single device in an application these days. Using your technique I was able to get multiple devices sharing code and playing nice all in one PlatformIO project.
Thanks this was very helpful! Another tip - if you want to use the GUI checkmark to build or upload, you can use the “Project Selector” at the bottom of the screen to choose a specific environment. (“Penumbra_Agent”) in this image.