Files

4.0 KiB
Raw Permalink Blame History

LCD

屏幕像素为320x240,以屏幕左上角为原点(0,0)

M5.lcd.setBrightness(uint8_t brightness);

例程

M5.lcd.setBrightness(200);

设置整个屏幕显示的亮度。

参数 描述
brightness 屏幕的亮度(0-254)

M5.Lcd.setCursor(uint16_t x0, uint16_t y0);

例程

M5.lcd.setCursor(20, 40);

设置下一次要显示的起始位置(x0, y0)


M5.Lcd.fillScreen(uint16_t color);

例程

M5.Lcd.fillScreen(BLUE)

以指定的颜色填充整个屏幕。

参数 描述
color 颜色值

M5.Lcd.drawPixel(int16_t x, int16_t y, uint16_t color);

例程

M5.Lcd.drawPixel(20, 40);

在位置(x,y)处画color颜色的点。

如果函数的color值没给出,则使用当前的背景颜色。


M5.Lcd.drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color);

例程

M5.Lcd.drawLine(0,0,12,12,BLUE);

以指定的颜色color从点(x0,y0)到点(x1,y1)画直线。

如果函数的color值没给出,则使用当前的背景颜色。


M5.Lcd.drawTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color);

例程

M5.Lcd.drawTriangle(22,22,69,98,51,22,BLUE);

以指定颜色color画三角形,顶点分别为(x,y)(x1,y1)和(x2,y2)。

如果函数的color值没给出,则使用当前的背景颜色。


M5.Lcd.fillTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color);

例程

M5.Lcd.fillTriangle(122, 122, 169, 198, 151, 182, BLUE);

以指定颜色画填充形式的三角形,顶点分别为(x,y)(x1,y1)和(x2,y2)。

如果函数的color值没给出,则使用当前的背景颜色。