目的:
ESP32 の ファイルシステム (LittleFS) にファイルをアップロードする為のアップローダーをインストールする 。ここでは、WSL にインストールした Linux用 arduino IDE 2.xx にインストールを行う。
手順:
- Uploader のインストール
- arduino IDE 停止
arduino IDE が動作していたら停止する。
"ファイル" - "停止" - Uploader の ダウンロード
アップローダーのダウンロードページ
https://github.com/earlephilhower/arduino-littlefs-upload
の「Installation」 にある "VSIX file" をクリック すると、
uploader (arduino-littlefs-upload-x.x.x.vsix) がある。
これをクリックしてダウンロードする。 - アップローダ の格納
arduino IDE の コンフィグレーションディレクトリ (~/.ardinoIDE) の下に plusins ディレクトリを作る。
ダウンロードしたファイルを ~/.arduinoIDE/plugins/ の下に格納する。 - arduino 起動
arduino IDE を起動する。
- arduino IDE 停止
- アップロード
- シリアルモニタが開いていれば閉じる。
- スケッチのあるフォルダに "data" フォルダを作成し、その下にアップロードするファイルを格納する。
- Ctrl+Shift+Pでコマンドパレットを開き、「Upload LittleFS to Pico/ESP8266/ESP32」を選択する。
なので、ファイルを消去する場合は、"data"フォルダから消去して再度アップロードすれば消える。 - シリアルモニタが開いていれば閉じる。
- アップロード確認
ファイルシステムにあるファイルのリストを取得するスケッチを以下に示す。
#include <LittleFS.h> // ; // ; void setup() { // File root ; // root Dirctory 定義 File file ; // // Serial.begin(115200); // シリアル 開始 Serial.println("") ; // Serial.println(" ---- File List ------") ; // // ; // LittleFS テスト ------------------------- // if (!LittleFS.begin(true)) { // LittleFS 開始 Serial.println("LittleFS のマウントに失敗") ; // return ; // } // // ; root = LittleFS.open("/"); // root ディレクトリオープン if (!root) { // Serial.println("root dir オープン失敗") ; // return; // } // // ; if (!root.isDirectory()) { // ディレクトリ判定 Serial.println("/ はディレクトリでない!!"); // return; // } // // ; file = root.openNextFile(); // ファイルをオープン while (file) { // ファイルがある限りループ Serial.print(" FILE: "); // Serial.print(file.name()); // ファイル名を表示 if (file.isDirectory()) { // ディレクトリなら、"DIR"を表示 Serial.print(" DIR"); // } // Serial.print(" SIZE: "); // ファイルサイズを表示 Serial.println(file.size()); // file = root.openNextFile(); // } // } // // ; void loop() { // loop は未使用 } // // ;
実行結果

0 件のコメント:
コメントを投稿