Arduino Quick Start
APIs and sample programs for Fire display output.
#include "M5Unified.h"
void setup() {
M5.begin();
int textsize = M5.Display.height() / 60;
if (textsize == 0) {
textsize = 1;
}
M5.Display.setTextSize(textsize);
}
void loop() {
int x = rand() % M5.Display.width();
int y = rand() % M5.Display.height();
int r = (M5.Display.width() >> 4) + 2;
uint16_t c = rand();
M5.Display.fillCircle(x, y, r, c);
draw_function(&M5.Display);
}
void draw_function(LovyanGFX* gfx) {
int x = rand() % gfx->width();
int y = rand() % gfx->height();
int r = (gfx->width() >> 4) + 2;
uint16_t c = rand();
gfx->fillRect(x - r, y - r, r * 2, r * 2, c);
}
Running result:
The Fire Display uses the M5GFX
library as its driver. For more related APIs, please refer to the following documentation: