The following API uses the RGB565 color coding format
#define BLACK 0x0000 /* 0, 0, 0 */#define NAVY 0x000F /* 0, 0, 128 */#define DARKGREEN 0x03E0 /* 0, 128, 0 */#define DARKCYAN 0x03EF /* 0, 128, 128 */#define MAROON 0x7800 /* 128, 0, 0 */#define PURPLE 0x780F /* 128, 0, 128 */#define OLIVE 0x7BE0 /* 128, 128, 0 */#define LIGHTGREY 0xC618 /* 192, 192, 192 */#define DARKGREY 0x7BEF /* 128, 128, 128 */#define BLUE 0x001F /* 0, 0, 255 */#define GREEN 0x07E0 /* 0, 255, 0 */#define CYAN 0x07FF /* 0, 255, 255 */#define RED 0xF800 /* 255, 0, 0 */#define MAGENTA 0xF81F /* 255, 0, 255 */#define YELLOW 0xFFE0 /* 255, 255, 0 */#define WHITE 0xFFFF /* 255, 255, 255 */#define ORANGE 0xFDA0 /* 255, 180, 0 */#define GREENYELLOW 0xB7E0 /* 180, 255, 0 */#define PINK 0xFC9F /* 255, 255, 16 */
Syntax:
void fillScreen(uint32_t color);
Description:
Parameters:
Return:
Example:
#include <M5StickC.h> void setup() { M5.begin(); M5.Lcd.fillScreen(BLUE);}void loop() {}
Syntax:
void setTextColor(uint16_t color, uint16_t backgroundcolor);
Description:
Parameters:
Return:
Example:
#include <M5StickC.h> void setup() { M5.begin(); M5.Lcd.setTextColor(RED, WHITE); M5.Lcd.println("Hello, M5Stack world!!");}void loop() {}
Syntax:
size_t print(const String &s);
Description:
Starts printing text at the current cursor position on the screen
Parameters:
Return:
Example:
#include <M5StickC.h> void setup() { M5.begin(); M5.Lcd.print("print text");}void loop() {}
Syntax:
void setCursor(int16_t x0, int16_t y0);
Description:
Parameters:
Return:
Example:
#include <M5StickC.h> void setup() { M5.begin(); M5.Lcd.setCursor(7, 20); M5.Lcd.println("scan done"); M5.Lcd.setCursor(5, 60); M5.Lcd.printf("50 AP");}void loop(){}
Syntax:
void drawPixel(int16_t x, int16_t y, uint16_t color);
Description:
Parameters:
Return:
Example:
#include <M5StickC.h> void setup() { M5.begin(); M5.Lcd.drawPixel(22, 22, RED);}void loop() {}
Syntax:
void drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color);
Description:
Parameters:
Return:
Example:
#include <M5StickC.h> void setup() { M5.begin(); M5.Lcd.drawLine(0, 0, 12, 12, BLUE);}void loop() {}
Syntax:
void drawTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color);
Description:
Parameters:
Return:
Example:
#include <M5StickC.h> void setup() { M5.begin(); M5.Lcd.drawTriangle(22, 22, 69, 98, 51, 22, RED);}void loop() {}
Syntax:
void fillTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color);
Description:
Parameters:
Return:
Example:
#include <M5StickC.h> void setup() { M5.begin(); M5.Lcd.fillTriangle(22, 22, 69, 98, 51, 22, RED);}void loop() {}
Syntax:
void drawRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
Description:
Parameters:
Return:
Example:
#include <M5StickC.h> void setup() { M5.begin(); M5.Lcd.drawRect(50, 100, 30, 10, BLUE);}void loop() {}
Description:
Syntax:
void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
Parameters:
Return:
Example:
#include <M5StickC.h> void setup() { M5.begin(); M5.Lcd.fillRect(50, 100, 20, 10, BLUE);}void loop() {}
Syntax:
void drawRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color);
Description:
Parameters:
Return:
Example:
#include <M5StickC.h> void setup() { M5.begin(); M5.Lcd.fillRoundRect(40, 70, 20, 10, 4, BLUE);}void loop() {}