How to use a specific espressif32 platformio version in PlatformIO

For production projects, you often want to lock platform & library versions in order to avoid an update suddenly breaking your code:

In platformio.ini, instead of

platformio.ini
platform = espressif32

use this syntax to refer to the git repository and a specific tag (v3.4.0 in this example) directly:

platformio.ini
platform = https://github.com/platformio/platform-espressif32.git#v3.4.0

Check out similar posts by category: Arduino, Electronics, Embedded, ESP8266/ESP32, PlatformIO