iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
📟

Introduction to the M5STACK Basic V2.7 Development Environment

に公開

Development Environment Setup

M5 Stack overall documentation
https://docs.m5stack.com/en/start

Several Development Environments Exist

Mainly Arduino IDE and UIFlow

Arduino IDE

This is the one I'm planning to introduce this time
https://docs.m5stack.com/en/arduino/arduino_ide

UIFlow

https://uiflow2.m5stack.com/

Arduino IDE

Download

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

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

Download from here, select according to your OS

Installation

When you run the downloaded installer...





Launch, Initial Settings, Japanese Language

An Arduino IDE icon appears in the Start menu

Run Arduino IDE from the Start menu.
You will be prompted for permission; grant it.
An automatic update begins.

Other installations such as drivers also start automatically.

Open File -> Preferences to change to Japanese

Refer to this to set the Additional Board Manager URLs
https://docs.m5stack.com/en/arduino/arduino_board

The Japanese translation looks a bit off

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

Enter the above here and press OK

Adding the Board to Use

Open Board Manager, search for M5 stack, and click Install.
The 3.x.x versions seem to be unstable or not working properly, so select 2.1.4.

Console Output
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 installed
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 installed
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 installed
Installing m5stack:xtensa-esp-elf-gdb@11.2_20220823
Configuring tool.
m5stack:xtensa-esp-elf-gdb@11.2_20220823 installed
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 installed
Installing m5stack:riscv32-esp-elf-gdb@11.2_20220823
Configuring tool.
m5stack:riscv32-esp-elf-gdb@11.2_20220823 installed
Installing m5stack:openocd-esp32@v0.12.0-esp32-20230419
Configuring tool.
m5stack:openocd-esp32@v0.12.0-esp32-20230419 installed
Installing m5stack:esptool_py@4.5.1
Configuring tool.
m5stack:esptool_py@4.5.1 installed
Installing m5stack:mkspiffs@0.2.3
Configuring tool.
m5stack:mkspiffs@0.2.3 installed
Installing m5stack:mklittlefs@3.0.0-gnu12-dc7f933
Configuring tool.
m5stack:mklittlefs@3.0.0-gnu12-dc7f933 installed
Installing arduino:dfu-util@0.11.0-arduino5
Configuring tool.
arduino:dfu-util@0.11.0-arduino5 installed
Installing platform m5stack:esp32@2.1.4
Configuring platform.
Platform m5stack:esp32@2.1.4 installed

Successfully installed

Installing Libraries

Open Library Manager, search for M5stack, and install
For this, the latest version 0.4.6 seems to be fine
It seems to resolve all dependencies, so click Install All

Console Output
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

Connecting M5STACK and PC

Connect M5STACK Basic to the PC
Check that it is recognized in Device Manager

Which one is the M5STACK BASIC?
It seems to be included in the Core series

Select Core

Select the connected port

Hello, World

Write Some Code

#include <M5Stack.h>

void setup() {
  M5.begin();                 // Initialize M5Stack
  M5.Lcd.clear();             // Clear screen
  M5.Lcd.setTextSize(3);      // Font size (optional)
  M5.Lcd.setCursor(20, 20);   // Display position (x=20, y=20)
  M5.Lcd.print("HELLO,WORLD"); 
}

void loop() {
  // No special processing
}

Compile and Upload

It Works

Discussion