📟

M5STACK Basic V2.7 開発環境の導入

に公開

開発環境構築

M5 Stack 全体のドキュメント
https://docs.m5stack.com/ja/start

開発環境はいくつかある

主にはArduino IDEと UIFlow

Arduino IDE

今回導入しようと思っているのはこっち
https://docs.m5stack.com/ja/arduino/arduino_ide

UIFlow

https://uiflow2.m5stack.com/

Arduino IDE

ダウンロード

https://www.arduino.cc/ja/main/software

https://www.arduino.cc/en/software/#ide

ここからダウンロード、使ってるOSとかにあわせて選択

インストール

ダウンロードしたインストーラーを実行すると……





起動・初期設定・日本語化

スタートメニューに Arduino IDE のアイコンができている

スタートメニューから Arduino IDE を実行する。
権限を求められるので許可する。
自動的にアップデートがはじまる。

他にもドライバーなどのインストールが自動的にはじまる。

File -> Preferences を開いて日本語化

ここを参考に Additional Board Manager URLs を設定
https://docs.m5stack.com/ja/arduino/arduino_board

ニホンゴアヤシイ

https://static-cdn.m5stack.com/resource/arduino/package_m5stack_index.json 

上記をここへ入力してOKを押す

使用するボードの追加

Board Manager を開いて M5 stack を検索しインストールをクリックする。
3.x.x系は不安定だったりうまく動かなかったりするらしいので、2.1.4を選択する。

コンソール出力
Downloading packages
m5stack:xtensa-esp32-elf-gcc@esp-2021r2-patch5-8.4.0
m5stack:xtensa-esp32s2-elf-gcc@esp-2021r2-patch5-8.4.0
m5stack:xtensa-esp32s3-elf-gcc@esp-2021r2-patch5-8.4.0
m5stack:xtensa-esp-elf-gdb@11.2_20220823
m5stack:riscv32-esp-elf-gcc@esp-2021r2-patch5-8.4.0
m5stack:riscv32-esp-elf-gdb@11.2_20220823
m5stack:openocd-esp32@v0.12.0-esp32-20230419
m5stack:esptool_py@4.5.1
m5stack:mkspiffs@0.2.3
m5stack:mklittlefs@3.0.0-gnu12-dc7f933
arduino:dfu-util@0.11.0-arduino5
m5stack:esp32@2.1.4
Installing m5stack:xtensa-esp32-elf-gcc@esp-2021r2-patch5-8.4.0
Configuring tool.
m5stack:xtensa-esp32-elf-gcc@esp-2021r2-patch5-8.4.0をインストールしました
Installing m5stack:xtensa-esp32s2-elf-gcc@esp-2021r2-patch5-8.4.0
Configuring tool.
m5stack:xtensa-esp32s2-elf-gcc@esp-2021r2-patch5-8.4.0をインストールしました
Installing m5stack:xtensa-esp32s3-elf-gcc@esp-2021r2-patch5-8.4.0
Configuring tool.
m5stack:xtensa-esp32s3-elf-gcc@esp-2021r2-patch5-8.4.0をインストールしました
Installing m5stack:xtensa-esp-elf-gdb@11.2_20220823
Configuring tool.
m5stack:xtensa-esp-elf-gdb@11.2_20220823をインストールしました
Installing m5stack:riscv32-esp-elf-gcc@esp-2021r2-patch5-8.4.0
Configuring tool.
m5stack:riscv32-esp-elf-gcc@esp-2021r2-patch5-8.4.0をインストールしました
Installing m5stack:riscv32-esp-elf-gdb@11.2_20220823
Configuring tool.
m5stack:riscv32-esp-elf-gdb@11.2_20220823をインストールしました
Installing m5stack:openocd-esp32@v0.12.0-esp32-20230419
Configuring tool.
m5stack:openocd-esp32@v0.12.0-esp32-20230419をインストールしました
Installing m5stack:esptool_py@4.5.1
Configuring tool.
m5stack:esptool_py@4.5.1をインストールしました
Installing m5stack:mkspiffs@0.2.3
Configuring tool.
m5stack:mkspiffs@0.2.3をインストールしました
Installing m5stack:mklittlefs@3.0.0-gnu12-dc7f933
Configuring tool.
m5stack:mklittlefs@3.0.0-gnu12-dc7f933をインストールしました
Installing arduino:dfu-util@0.11.0-arduino5
Configuring tool.
arduino:dfu-util@0.11.0-arduino5をインストールしました
Installing platform m5stack:esp32@2.1.4
Configuring platform.
Platform m5stack:esp32@2.1.4 installed

無事にインストールできた様子

ライブラリの導入

Library Manager を開いて M5stack を検索してインストール
こちらに関しては最新版の0.4.6でOKな様子
依存関係とかも全部解決してくれるらしい全てインストールをクリック

コンソール出力
Downloading MFRC522_I2C@1.0.0
MFRC522_I2C@1.0.0
Installing MFRC522_I2C@1.0.0
Installed MFRC522_I2C@1.0.0
Downloading DFRobot_PAJ7620U2@1.0.1
DFRobot_PAJ7620U2@1.0.1
Installing DFRobot_PAJ7620U2@1.0.1
Installed DFRobot_PAJ7620U2@1.0.1
Downloading arduinoFFT@2.0.4
arduinoFFT@2.0.4
Installing arduinoFFT@2.0.4
Installed arduinoFFT@2.0.4
Downloading Adafruit NeoPixel@1.15.2
Adafruit NeoPixel@1.15.2
Installing Adafruit NeoPixel@1.15.2
Installed Adafruit NeoPixel@1.15.2
Downloading bsec2@1.10.2610
bsec2@1.10.2610
Installing bsec2@1.10.2610
Installed bsec2@1.10.2610
Downloading M5Family@0.1.3
M5Family@0.1.3
Installing M5Family@0.1.3
Installed M5Family@0.1.3
Downloading Module_GRBL_13.2@0.0.3
Module_GRBL_13.2@0.0.3
Installing Module_GRBL_13.2@0.0.3
Installed Module_GRBL_13.2@0.0.3
Downloading M5GFX@0.2.17
M5GFX@0.2.17
Installing M5GFX@0.2.17
Installed M5GFX@0.2.17
Downloading M5-ADS1100@0.0.1
M5-ADS1100@0.0.1
Installing M5-ADS1100@0.0.1
Installed M5-ADS1100@0.0.1
Downloading TinyGPSPlus@1.0.3
TinyGPSPlus@1.0.3
Installing TinyGPSPlus@1.0.3
Installed TinyGPSPlus@1.0.3
Downloading VL53L0X@1.3.1
VL53L0X@1.3.1
Installing VL53L0X@1.3.1
Installed VL53L0X@1.3.1
Downloading M5-Ethernet@4.0.0
M5-Ethernet@4.0.0
Installing M5-Ethernet@4.0.0
Installed M5-Ethernet@4.0.0
Downloading M5Module-4Relay@0.0.3
M5Module-4Relay@0.0.3
Installing M5Module-4Relay@0.0.3
Installed M5Module-4Relay@0.0.3
Downloading Adafruit BusIO@1.17.4
Adafruit BusIO@1.17.4
Installing Adafruit BusIO@1.17.4
Installed Adafruit BusIO@1.17.4
Downloading SparkFun MAX3010x Pulse and Proximity Sensor Library@1.1.2
SparkFun MAX3010x Pulse and Proximity Sensor Library@1.1.2
Installing SparkFun MAX3010x Pulse and Proximity Sensor Library@1.1.2
Installed SparkFun MAX3010x Pulse and Proximity Sensor Library@1.1.2
Downloading M5Unit-EXTIO2@1.0.3
M5Unit-EXTIO2@1.0.3
Installing M5Unit-EXTIO2@1.0.3
Installed M5Unit-EXTIO2@1.0.3
Downloading MAX30100lib@1.2.1
MAX30100lib@1.2.1
Installing MAX30100lib@1.2.1
Installed MAX30100lib@1.2.1
Downloading M5Unit-PoESP32@0.0.1
M5Unit-PoESP32@0.0.1
Installing M5Unit-PoESP32@0.0.1
Installed M5Unit-PoESP32@0.0.1
Downloading Adafruit SGP30 Sensor@2.0.3
Adafruit SGP30 Sensor@2.0.3
Installing Adafruit SGP30 Sensor@2.0.3
Installed Adafruit SGP30 Sensor@2.0.3
Downloading ADXL345@0.2.0
ADXL345@0.2.0
Installing ADXL345@0.2.0
Installed ADXL345@0.2.0
Downloading M5-RoverC@0.0.1
M5-RoverC@0.0.1
Installing M5-RoverC@0.0.1
Installed M5-RoverC@0.0.1
Downloading M5Utility@0.0.9
M5Utility@0.0.9
Installing M5Utility@0.0.9
Installed M5Utility@0.0.9
Downloading M5Unit-RELAY@0.0.2
M5Unit-RELAY@0.0.2
Installing M5Unit-RELAY@0.0.2
Installed M5Unit-RELAY@0.0.2
Downloading M5Unit-ACSSR@0.0.3
M5Unit-ACSSR@0.0.3
Installing M5Unit-ACSSR@0.0.3
Installed M5Unit-ACSSR@0.0.3
Downloading M5-FPC1020A@1.0.0
M5-FPC1020A@1.0.0
Installing M5-FPC1020A@1.0.0
Installed M5-FPC1020A@1.0.0
Downloading M5Unified@0.2.11
M5Unified@0.2.11
Installing M5Unified@0.2.11
Installed M5Unified@0.2.11
Downloading M5-DLight@0.0.3
M5-DLight@0.0.3
Installing M5-DLight@0.0.3
Installed M5-DLight@0.0.3
Downloading Blynk@1.3.2
Blynk@1.3.2
Installing Blynk@1.3.2
Installed Blynk@1.3.2
Downloading ArduinoECCX08@1.3.9
ArduinoECCX08@1.3.9
Installing ArduinoECCX08@1.3.9
Installed ArduinoECCX08@1.3.9
Downloading M5-ADS1115@1.0.0
M5-ADS1115@1.0.0
Installing M5-ADS1115@1.0.0
Installed M5-ADS1115@1.0.0
Downloading M5_EzData@0.0.2
M5_EzData@0.0.2
Installing M5_EzData@0.0.2
Installed M5_EzData@0.0.2
Downloading TFTTerminal@0.0.1
TFTTerminal@0.0.1
Installing TFTTerminal@0.0.1
Installed TFTTerminal@0.0.1
Downloading ArduinoJson@7.4.2
ArduinoJson@7.4.2
Installing ArduinoJson@7.4.2
Installed ArduinoJson@7.4.2
Downloading PCA9554@0.0.1
PCA9554@0.0.1
Installing PCA9554@0.0.1
Installed PCA9554@0.0.1
Downloading IRremote@4.5.0
IRremote@4.5.0
Installing IRremote@4.5.0
Installed IRremote@4.5.0
Downloading UNIT_GLASS@0.0.1
UNIT_GLASS@0.0.1
Installing UNIT_GLASS@0.0.1
Installed UNIT_GLASS@0.0.1
Downloading M5Unit-KMeter@0.1.1
M5Unit-KMeter@0.1.1
Installing M5Unit-KMeter@0.1.1
Installed M5Unit-KMeter@0.1.1
Downloading HX711 Arduino Library@0.7.5
HX711 Arduino Library@0.7.5
Installing HX711 Arduino Library@0.7.5
Installed HX711 Arduino Library@0.7.5
Downloading M5Unit-ENV@1.3.1
M5Unit-ENV@1.3.1
Installing M5Unit-ENV@1.3.1
Installed M5Unit-ENV@1.3.1
Downloading M5Unit-Encoder@0.0.2
M5Unit-Encoder@0.0.2
Installing M5Unit-Encoder@0.0.2
Installed M5Unit-Encoder@0.0.2
Downloading BME68x Sensor library@1.3.40408
BME68x Sensor library@1.3.40408
Installing BME68x Sensor library@1.3.40408
Installed BME68x Sensor library@1.3.40408
Downloading TinyGPSPlus-ESP32@0.0.2
TinyGPSPlus-ESP32@0.0.2
Installing TinyGPSPlus-ESP32@0.0.2
Installed TinyGPSPlus-ESP32@0.0.2
Downloading FastLED@3.10.3
FastLED@3.10.3
Installing FastLED@3.10.3
Installed FastLED@3.10.3
Downloading Adafruit MCP4725@2.0.2
Adafruit MCP4725@2.0.2
Installing Adafruit MCP4725@2.0.2
Installed Adafruit MCP4725@2.0.2
Downloading DFRobot_GP8XXX@1.1.0
DFRobot_GP8XXX@1.1.0
Installing DFRobot_GP8XXX@1.1.0
Installed DFRobot_GP8XXX@1.1.0
Downloading M5Unit-Sonic@0.0.2
M5Unit-Sonic@0.0.2
Installing M5Unit-Sonic@0.0.2
Installed M5Unit-Sonic@0.0.2
Downloading M5UnitUnified@0.3.0
M5UnitUnified@0.3.0
Installing M5UnitUnified@0.3.0
Installed M5UnitUnified@0.3.0
Downloading ArduinoHttpClient@0.6.1
ArduinoHttpClient@0.6.1
Installing ArduinoHttpClient@0.6.1
Installed ArduinoHttpClient@0.6.1
Downloading LoRa@0.8.0
LoRa@0.8.0
Installing LoRa@0.8.0
Installed LoRa@0.8.0
Downloading M5Unit-DDS@0.1.0
M5Unit-DDS@0.1.0
Installing M5Unit-DDS@0.1.0
Installed M5Unit-DDS@0.1.0
Downloading M5Unit-UHF-RFID@0.0.3
M5Unit-UHF-RFID@0.0.3
Installing M5Unit-UHF-RFID@0.0.3
Installed M5Unit-UHF-RFID@0.0.3
Downloading M5Unit-RTC@0.0.2
M5Unit-RTC@0.0.2
Installing M5Unit-RTC@0.0.2
Installed M5Unit-RTC@0.0.2
Downloading USB Host Shield Library 2.0@1.7.0
USB Host Shield Library 2.0@1.7.0
Installing USB Host Shield Library 2.0@1.7.0
Installed USB Host Shield Library 2.0@1.7.0
Downloading Adafruit TCS34725@1.4.4
Adafruit TCS34725@1.4.4
Installing Adafruit TCS34725@1.4.4
Installed Adafruit TCS34725@1.4.4
Downloading TinyGSM@0.12.0
TinyGSM@0.12.0
Installing TinyGSM@0.12.0
Installed TinyGSM@0.12.0
Downloading mcp_can@1.5.1
mcp_can@1.5.1
Installing mcp_can@1.5.1
Installed mcp_can@1.5.1
Downloading ESP8266Audio@2.4.1
ESP8266Audio@2.4.1
Installing ESP8266Audio@2.4.1
Installed ESP8266Audio@2.4.1
Downloading M5Unit-MQTT@0.0.1
M5Unit-MQTT@0.0.1
Installing M5Unit-MQTT@0.0.1
Installed M5Unit-MQTT@0.0.1
Downloading PubSubClient@2.8.0
PubSubClient@2.8.0
Installing PubSubClient@2.8.0
Installed PubSubClient@2.8.0
Downloading M5Stack@0.4.6
M5Stack@0.4.6
Installing M5Stack@0.4.6
Installed M5Stack@0.4.6
Downloading U8g2@2.35.30
U8g2@2.35.30
Installing U8g2@2.35.30
Installed U8g2@2.35.30
Downloading M5HAL@0.0.2
M5HAL@0.0.2
Installing M5HAL@0.0.2
Installed M5HAL@0.0.2
Downloading BlynkNcpDriver@0.6.3
BlynkNcpDriver@0.6.3
Installing BlynkNcpDriver@0.6.3
Installed BlynkNcpDriver@0.6.3
Downloading ClosedCube TCA9548A@2019.3.23
ClosedCube TCA9548A@2019.3.23
Installing ClosedCube TCA9548A@2019.3.23
Installed ClosedCube TCA9548A@2019.3.23
Downloading M5_BMM150@0.0.2
M5_BMM150@0.0.2
Installing M5_BMM150@0.0.2
Installed M5_BMM150@0.0.2

M5STACKとPCの接続

M5STACK Basic と PC を接続する
デバイスマネージャーで認識されていることを確認

M5STACK BASIC ってどれだよ?
どうも Core シリーズに含まれるらしい

Core を選択する

接続されているポートを選択

Hello, World

適当にコードを書く

#include <M5Stack.h>

void setup() {
  M5.begin();                 // M5Stack の初期化
  M5.Lcd.clear();             // 画面クリア
  M5.Lcd.setTextSize(3);      // 文字サイズ(任意)
  M5.Lcd.setCursor(20, 20);   // 表示位置(x=20, y=20)
  M5.Lcd.print("HELLO,WORLD"); 
}

void loop() {
  // 特に処理なし
}

コンパイルして書き込む

動いた

Discussion