Dynamic variables

New in version 3.1.

Dynamic variables/templates are useful when you have common configuration data between build environments. For examples, common build_flags or project dependencies lib_deps.

Each variable should have a next format: ${<section>.<option>}, where <section> is a value from [<section>] group, and <option> is a first item from pair <option> = value.

You can inject system environment variable using sysenv as a section. For example, ${sysenv.HOME}, etc.

Example:

[platformio]
; Unix
lib_extra_dirs = ${sysenv.HOME}/Documents/Arduino/libraries
; Windows
lib_extra_dirs = ${sysenv.HOMEDRIVE}${sysenv.HOMEPATH}\Documents\Arduino\libraries

; You MUST inject these options into [env:] section
; using ${common.***} (see below)
[common]
build_flags = -D VERSION=1.2.3 -D DEBUG=1
lib_deps_builtin =
  SPI
  Wire
lib_deps_external = ArduinoJson@>5.6.0

[env:uno]
platform = atmelavr
framework = arduino
board = uno
build_flags = ${common.build_flags}
lib_deps =
  ${common.lib_deps_builtin}
  ${common.lib_deps_external}

[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
build_flags = ${common.build_flags} -DSSID_NAME=HELLO -DSSID_PASWORD=WORLD
lib_deps =
  ${common.lib_deps_builtin}
  ${common.lib_deps_external}
  PubSubClient@2.6
  OneWire