pdf-icon

Arduino入門

2. デバイス&サンプル

6. アプリケーション

Unit C6L Display

Unit C6L Display に関連する API とサンプルプログラムです。

サンプルプログラム

コンパイル要件

  • M5Stack ボードマネージャ バージョン >= 3.2.3
  • ボードオプション = M5UnitC6L
  • M5Unified ライブラリ バージョン >= 0.2.10
  • M5GFX ライブラリ バージョン >= 0.2.15
cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
#include <M5Unified.h>

void setup() {
  M5.begin();

  M5.Display.setTextSize(1);
  M5.Display.clear();
}

void loop() {
  M5.Display.setCursor(0, 0);
  M5.Display.print("This is \nUnit C6L");
  delay(1000);
  M5.Display.clear();

  M5.Display.drawRect(0, 0, 64, 48, 0xFFFF);  // x, y, w, h, color
  delay(500);
  M5.Display.drawCircle(10, 10, 8, 0xFFFF);  // x, y, r, color
  delay(500);
  M5.Display.fillArc(26, 32, 8, 12, 100, 330, 0xFFFF);  // x, y, r0, r1, angle0, angle1, color
  delay(500);
  M5.Display.fillRect(24, 7, 15, 7, 0xFFFF);  // x, y, w, h, color
  delay(500);
  M5.Display.fillTriangle(45, 7, 40, 30, 55, 42, 0xFFFF);  // x0, y0, x1, y1, x2, y2, color
  delay(500);
  M5.Display.drawLine(55, 0, 64, 48, 0xFFFF);  // x0, y0, x1, y1, color
  delay(1000);

  M5.Display.clear();
}

動作結果:

API

Unit C6L Display 部分は M5GFX ライブラリをドライバとして使用しています。関連する API の詳細については、以下のドキュメントを参照してください:

On This Page