pdf-icon

Arduino Quick Start

2. Devices & Examples

6. Applications

PowerHub Arduino Program Compile & Upload

1.Preparation

Compatibility Note
The latest M5Unified library is based on ESP-IDF v5.x, and is not compatible with ESP-IDF v4.x. Therefore, it supports Arduino IDE, but does not support PlatformIO.

2.Port Selection

Connect the device to your computer via a USB-C data cable. Press and hold the side BtnPWR button for 3 seconds until the indicator light next to the black antenna flashes blue several times. The device will then enter download mode, and you can select the corresponding controller and device port in Arduino IDE.

3.Program Compile & Upload

cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#include <M5Unified.h>

void setup() {
  M5.begin();
  M5.Led.setBrightness(127);
}

void loop() {
  M5.update();

  M5.Led.setAllColor(TFT_WHITE);
  M5.Led.display();
  delay(500);

  M5.Led.setAllColor(TFT_BLACK);
  M5.Led.display();
  delay(500);
}

Copy the above program into Arduino IDE, then click the Upload button. After the program is compiled and uploaded, all LEDs will flash white:

4.Related Resources

On This Page