ボード選択とライブラリ
ボード:M5StampS3
ライブラリ:M5Unified (+ EspEasyUtils もあったほうが便利)
書き込めない
BTN0を押しながらリセットボタンを押して離すとダウンロードモードになる。
BTN0が分かりにくいがラベルの上から押す。
Serial (USBシリアル) が出力されない
Arduino IDEなら Tools → USB CDC On Boot を Enable に設定する。
PlatformIOなら platformio.ini に下記を追記する。
build_flags = -DARDUINO_USB_CDC_ON_BOOT=1
動作確認用スケッチ
#include <Arduino.h> #include <M5Unified.h> #include <EspEasyLED.h> EspEasyLED *rgbled; void setup() { auto cfg = M5.config(); M5.begin(cfg); Serial.begin(115200); Serial.println("Hello, World!"); rgbled = new EspEasyLED(GPIO_NUM_21, 1, 20); } void loop() { Serial.println("Hello, World! from loop()"); if(rgbled){ rgbled->showColor(EspEasyLEDColor::RED); delay(1000); rgbled->showColor(EspEasyLEDColor::GREEN); delay(1000); rgbled->showColor(EspEasyLEDColor::BLUE); delay(1000); } }