ESP + Arduino IDE 2.x.x + PlatformIO

Arduino IDEESP32, ESP8266を搭載した各種マイコンボードを登録する方法

Welcome to ESP32 Arduino Core’s documentation

https://espressif-docs.readthedocs-hosted.com/projects/arduino-esp32/en/latest/index.html

Arduino IDE

以下PreferencesAdditional boards manager URLs に安定版または開発版のURLを入力

安定版URL

https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json

開発版URL

https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_dev_index.json

Welcome to ESP8266 Arduino Core’s documentation

https://arduino-esp8266.readthedocs.io/en/latest/

以下のURLをカンマを付けて Additional boards manager URLs に追加

https://arduino.esp8266.com/stable/package_esp8266com_index.json

PlatformIO

VSCodeでのPlatformIOの利用は、以下のパルスオキシメータのプロジェクトから開始しています。

VSCode : PlatformIO機能拡張

PlatformIOのインストール・使い方など
PlatformIO IDE for VSCode — PlatformIO latest documentation

ESP32

Espressif 32 — PlatformIO latest documentation
Installing — Arduino-ESP32 2.0.14 documentation

ESP8266

Espressif 8266 — PlatformIO latest documentation
Installing — ESP8266 Arduino Core 3.1.2-21-ga348833 documentation


注) 以下のマイコンボードに書込を行うためのUSB-Serialチップデバイスの登録が必要です。

PlatformIO Library Management

Library Management — PlatformIO latest documentation

プロジェクトに必要なライブラリは、以下の PIO HomeLibraries から入手出来ます。
入手したライブラリは、プロジェクトの platformio.ini ファイルに即座に反映されます。

ビルドの際にエラーの原因となっているライブラリについては、手動で lib_ignore のセクションで指定すること。

Library Dependency Finder (LDF) — PlatformIO latest documentation

platformio.ini

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200
lib_deps = 
	adafruit/Adafruit GFX Library@^1.10.10
	adafruit/Adafruit MQTT Library@^2.4.0
	bblanchon/ArduinoJson@^6.18.0
	adafruit/Adafruit MLX90614 Library@^2.1.3
	sparkfun/SparkFun MAX3010x Pulse and Proximity Sensor Library@^1.1.1
	adafruit/Adafruit BusIO@^1.7.5
	adafruit/Adafruit NeoPixel@^1.10.7
	adafruit/Adafruit SSD1306@^2.5.7
	mathertel/OneButton@^2.0.3
	khoih-prog/ESP_WifiManager@^1.12.1
lib_ignore = 
	WiFi101

PlatformIO: Can not find working Python 3.6+ Interpreter. Please install the latest Python 3 and restart VSCode

VSCodeをUbuntu24.04に新規インストール・起動時のエラー。
Python3の仮想環境構築パッケージがインストールされていないため、これをインストール。

$ sudo apt-get install python3-venv