Newer
Older
m5stickcplus / src / lcd01.ino
@Motoki Motoki 22 days ago 1 KB Plus2
#include <Arduino.h>
#include <M5Unified.h>

void setup() {
  auto cfg = M5.config();
  M5.begin(cfg);
  M5.Display.setRotation(3);
  M5.Display.fillRect(0, 0, 240, 135, RED); 
  //M5StickCPlusの画面サイズは、240 x 135

  M5.Display.fillRect(10, 10, 220, 115, ORANGE);
  M5.Display.fillRect(20, 20, 200, 95, YELLOW);
  M5.Display.fillRect(30, 30, 180, 75, GREENYELLOW);
  M5.Display.fillRect(40, 40, 160, 55, CYAN);
  M5.Display.fillRect(50, 50, 140, 35, BLUE);
  M5.Display.fillRect(60, 60, 120, 15, MAGENTA);

  M5.Display.setTextFont(1); // 8pixel ASCII font
  M5.Display.setTextSize(1); // Magnify (x1-7)
  M5.Display.setTextColor(WHITE);
  M5.Display.setCursor(10,1); M5.Lcd.print("RED");
  M5.Display.setTextColor(BLACK);
  M5.Display.setCursor(20,11); M5.Lcd.print("ORANGE");
  M5.Display.setCursor(30,21); M5.Lcd.print("YELLOW");
  M5.Display.setCursor(40,31); M5.Lcd.print("GREENYELLOW");
  M5.Display.setCursor(50,41); M5.Lcd.print("CYAN");
  M5.Display.setTextColor(WHITE);
  M5.Display.setCursor(60,51); M5.Lcd.print("BLUE");
  M5.Display.setCursor(70,60,2); M5.Lcd.print("MAGENTA (2)");
  // setCursorの第3引数は、TextFont番号

  M5.Display.setTextColor(BLACK);
  M5.Display.setCursor(30,90,4);
  M5.Display.print("26pixel ASCII (4)");
}

void loop() {
  M5.delay(100);
}