hello-stick.ino
First pixels on the mini station: M5Unified handles rotation and the framebuffer of the 1.14" ST7789. In 240×135 landscape, printf becomes a pocket debug console.
Hardware required
An M5StickC Plus2 (ESP32-PICO-V3-02, 135×240 display, A/B/C buttons, passive buzzer on G2, IR + red LED on G19, MPU6886 IMU, microphone, 200 mAh battery). None.
Wiring
No wiring. On the PMIC-less v2: hold button C over 2 s to power on; HOLD (G4) latches the supply on battery.
How it works
M5.begin detects the panel and applies rotation; setTextColor/fillRect draw directly. M5.update refreshes buttons A (38), B (37) and C (35). In the Arduino IDE (esp32 package), board « M5StickCPlus2 »; « M5StickCPlus2 » or M5Unified library. On the PMIC-less v2, hold button C for >2 s to power on; HOLD (G4) latches the power.
Going further
Blank the screen with M5.Display.setBrightness(0) to save power, or show the time from the NTP sketch.
hello-stick.ino
// Hello ST7789 — bibliotheque M5Unified (Gestionnaire de bibliotheques).
#include <M5Unified.h>
void setup() {
auto cfg = M5.config();
M5.begin(cfg);
M5.Display.setRotation(1); // paysage : 240 x 135
M5.Display.fillScreen(TFT_BLACK);
M5.Display.setTextColor(TFT_YELLOW);
M5.Display.setTextSize(2);
M5.Display.setCursor(4, 4);
M5.Display.println("StickC Plus2");
}
void loop() {
M5.update();
M5.Display.fillRect(0, 40, 240, 60, TFT_BLACK);
M5.Display.setCursor(4, 44);
M5.Display.setTextSize(1);
M5.Display.printf("millis : %lu\n", millis());
M5.Display.printf("heap : %u o\n", ESP.getFreeHeap());
M5.Display.printf("btn A : %d\n", M5.BtnA.isPressed());
delay(200);
}