Display
StamPLC uses the M5GFX library as its display driver. Refer to the API & example below for simple display functions. For more API details, please refer to the
M5GFX
source code.
Example Program
#include <Arduino.h>
#include <M5StamPLC.h>
void setup()
{
M5StamPLC.begin();
}
void loop()
{
M5StamPLC.Display.fillScreen(TFT_WHITE);
delay(800);
M5StamPLC.Display.fillScreen(TFT_RED);
delay(800);
M5StamPLC.Display.fillScreen(TFT_GREEN);
delay(800);
M5StamPLC.Display.fillScreen(TFT_BLUE);
delay(800);
M5StamPLC.Display.fillScreen(TFT_BLACK);
delay(800);
M5StamPLC.Display.setCursor(10, 10);
M5StamPLC.Display.setTextColor(TFT_WHITE);
M5StamPLC.Display.setTextSize(1);
M5StamPLC.Display.printf("Display Test!");
delay(800);
M5StamPLC.Display.drawRect(100, 50, 50, 50, BLUE);
delay(800);
M5StamPLC.Display.fillRect(100, 50, 50, 50, BLUE);
delay(800);
M5StamPLC.Display.drawCircle(100, 50, 50, RED);
delay(800);
M5StamPLC.Display.fillCircle(100, 50, 50, RED);
delay(800);
M5StamPLC.Display.drawTriangle(30, 30, 180, 50, 80, 100, YELLOW);
delay(800);
M5StamPLC.Display.fillTriangle(30, 30, 180, 50, 80, 100, YELLOW);
delay(800);
for (int i = 0; i < 1000; i++) {
M5StamPLC.Display.fillTriangle(random(M5StamPLC.Display.width() - 1), random(M5StamPLC.Display.height() - 1),
random(M5StamPLC.Display.width() - 1), random(M5StamPLC.Display.height() - 1),
random(M5StamPLC.Display.width() - 1), random(M5StamPLC.Display.height() - 1),
random(0xfffe));
}
delay(800);
}