0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ATOMS3 Liteで有機ELで遊ぶ。(M5UnitGLASS2.h)(SSD1306)

Last updated at Posted at 2025-10-21

参考

いろいろ注意

  • 過去ログを見よ!!!
  • 各自、データシート確認の事
  • M5Stack Boards 3.2.3
  • やや、ヒット
  • いろいろ、したい事、スタックチャン
  • 配線

GND -> GND
5V -> 5V
SCL -> SCL
SDA -> SDA

結果

Screenshot from 2025-10-22 07-43-39.png

プログラム



#include <M5UnitGLASS2.h>
#include <M5Unified.h>

#define M5UNITGLASS2_ADDR 0x3C  // For Unit Glass2, 0x3C is default, and 0x3D is modified.

int index_unit_glass2;

void setup() {
  auto cfg = M5.config();
  cfg.external_display.unit_glass2 = true;
  M5.begin(cfg);

  index_unit_glass2 = M5.getDisplayIndex(m5::board_t::board_M5UnitGLASS2);
  M5.Displays(index_unit_glass2).setTextSize(2);
  M5.Displays(index_unit_glass2).clear();
}

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

  M5.Displays(index_unit_glass2).drawRect(0, 0, 128, 64, 0xFFFF);  // x, y, w, h, color
  delay(500);
  M5.Displays(index_unit_glass2).drawCircle(20, 20, 15, 0xFFFF);  // x, y, r, color
  delay(500);
  M5.Displays(index_unit_glass2).fillArc(50, 45, 17, 20, 100, 330, 0xFFFF);  // x, y, r0, r1, angle0, angle1, color
  delay(500);
  M5.Displays(index_unit_glass2).fillRect(45, 10, 25, 10, 0xFFFF);  // x, y, w, h, color
  delay(500);
  M5.Displays(index_unit_glass2).fillTriangle(90, 10, 80, 40, 110, 55, 0xFFFF);  // x0, y0, x1, y1, x2, y2, color
  delay(500);
  M5.Displays(index_unit_glass2).drawLine(110, 0, 128, 64, 0xFFFF);  // x0, y0, x1, y1, color
  delay(1000);

  M5.Displays(index_unit_glass2).clear();
} 


0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?