TFTスクリーン

M5StickC 屏幕像素为 80x160,以屏幕左上角为原点 (0,0)

ScreenBreath()

機能です:

画面のバックライト輝度を調節

原型関数です:

void ScreenBreath(uint8_t brightness)

パラメータです 記述します
brightness 背光值 ( 值: 7 - 16 )

使用例です:

#include <M5StickC.h>

uint8_t i = 7;

void setup() {
  M5.begin();
  M5.Lcd.fillScreen(WHITE);
}
void loop() {
  M5.Axp.ScreenBreath(i++);
  if (i > 15) i = 7;
  delay(500);
}

fillScreen()

機能です:

指定の色で画面全体を塗りつぶす

原型関数です:

fillScreen(uint16_t color)

パラメータです 記述します
color カラー値です

使用例です:

#include <M5StickC.h>

void setup() {
  M5.begin();
  M5.Lcd.fillScreen(BLUE);
}
void loop() {}

setTextColor()

機能です:

テキストの前景色と背景色を設定

原型関数です:

setTextColor(uint16_t color, uint16_t backgroundcolor)

パラメータです 記述します
color テキストの前景の色です
backgroundcolor テキストの背景色です

もし関数のbackgroundcolorの値が指定されていない場合は、現在の背景色を使用

使用例です:

#include <M5StickC.h>

void setup() {
  M5.begin();
  M5.Lcd.setTextColor(RED, WHITE);
  M5.Lcd.println("Hello, M5Stack world!!");
}
void loop() {
}

setCursor()

機能です:

カーソル位置を(x0, y0)に移動

原型関数です:

setCursor(int16_t x0, int16_t y0, uint8_t font)

使用例です:

#include <M5StickC.h>

void setup() {
  M5.begin();
  M5.Lcd.setCursor(7, 20, 2);
  M5.Lcd.println("scan done");
  M5.Lcd.setCursor(5, 60, 4);
  M5.Lcd.printf("50 AP");
}
void loop(){}

drawPixel()

機能です:

位置(x,y)に点を描く

原型関数です:

drawPixel(int16_t x, int16_t y, uint16_t color)

パラメータです 記述します
color カラー値です

もし関数のcolorの値が指定されていない場合は、現在の背景色を使用

使用例です:

#include <M5StickC.h>

void setup() {
  M5.begin();
  M5.Lcd.drawPixel(22, 22, RED);
}
void loop() {}

drawLine()

機能です:

指定の色で点(x,y)から点(x1,y1)までの直線を描く

原型関数です:

drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color)

パラメータです 記述します
color カラー値です

使用例です:

#include <M5StickC.h>

void setup() {
  M5.begin();
  M5.Lcd.drawLine(0, 0, 12, 12, BLUE);
}
void loop() {}

drawTriangle()

機能です:

指定の色で三角形を描く、頂点はそれぞれ(x,y),(x1,y1),(x2,y2)

原型関数です:

drawTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color)

パラメータです 記述します
color カラー値です

もし関数のcolorの値が指定されていない場合は、現在の背景色を使用

使用例です:

#include <M5StickC.h>

void setup() {
  M5.begin();
  M5.Lcd.drawTriangle(22, 22, 69, 98, 51, 22, RED);
}
void loop() {}

fillTriangle()

機能です:

指定の色で三角形を描く、頂点はそれぞれ(x,y),(x1,y1),(x2,y2)

原型関数です:

fillTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color)

パラメータです 記述します
color カラー値です

もし関数のcolorの値が指定されていない場合は、現在の背景色を使用

使用例です:

#include <M5StickC.h>

void setup() {
  M5.begin();
  M5.Lcd.fillTriangle(22, 22, 69, 98, 51, 22, RED);
}
void loop() {}

drawRect()

機能です:

指定の色で矩形を描く、矩形の左上の座標は(x,y)、幅と高さはそれぞれwidthとheight

原型関数です:

drawRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)

パラメータです 記述します
w グラフ幅(単位:ピクセル)
h 高パターン(単位:ピクセル)です
color カラー値です

もし関数のcolorの値が指定されていない場合は、現在の背景色を使用

使用例です:

#include <M5StickC.h>

void setup() {
  M5.begin();
  M5.Lcd.drawRect(50, 100, 30, 10, BLUE);
}
void loop() {}

fillRect()

機能です:

「塗りつぶし形式」の矩形を、左上の座標を(x,y)、縦幅をそれぞれwidth、heightとして指定の色で描きます。

原型関数です:

fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)

パラメータです 記述します
w グラフ幅(単位:ピクセル)
h 高パターン(単位:ピクセル)です
color カラー値です

もし関数のcolorの値が指定されていない場合は、現在の背景色を使用

使用例です:

#include <M5StickC.h>

void setup() {
  M5.begin();
  M5.Lcd.fillRect(50, 100, 20, 10, BLUE);
}
void loop() {}

drawRoundRect()

機能です:

左上の座標を(x,y),高さをwidth, height,角半径をradiusとした「角丸」の矩形を指定の色で描きます。

原型関数です:

drawRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color)

パラメータです 記述します
w グラフ幅(単位:ピクセル)
h 高パターン(単位:ピクセル)です
radius 圆角半径
color カラー値です

もし関数のcolorの値が指定されていない場合は、現在の背景色を使用

使用例です:

#include <M5StickC.h>

void setup() {
  M5.begin();
  M5.Lcd.fillRoundRect(40, 70, 20, 10, 4, BLUE);
}
void loop() {}

print()

機能です:

画面の現在位置から文字列(text)を印刷

原型関数です:

size_t print(const String &s)

デフォルトの印刷内容の色は白底黒字

使用例です:

#include <M5StickC.h>

void setup() {
  M5.begin();
  M5.Lcd.print("print text");
}
void loop() {}

Usage

#include <M5StickC.h>

void setup() {
  M5.begin();

  M5.Lcd.fillScreen(WHITE); //Set the default background color.  设置默认背景颜色
  M5.Lcd.drawLine(0, 0, 100, 100, WHITE);
  M5.Lcd.drawTriangle(22, 22, 69, 98, 51, 22, RED);
  M5.Lcd.fillTriangle(22, 22, 69, 98, 51, 22, RED);
  M5.Lcd.drawRect(50, 100, 30, 10, BLUE);
  M5.Lcd.fillRect(50, 100, 30, 10, BLUE);
  M5.Lcd.drawRoundRect(40, 70, 20, 10, 4, BLUE);
  M5.Lcd.fillRoundRect(40, 70, 20, 10, 4, BLUE);
  M5.Lcd.print("print text");
}
void loop() {}
On This Page