Skip to content

Instantly share code, notes, and snippets.

@nezuppo
Created April 26, 2021 14:48
Show Gist options
  • Save nezuppo/ae4fa119782325c2334fbfd249678162 to your computer and use it in GitHub Desktop.
Save nezuppo/ae4fa119782325c2334fbfd249678162 to your computer and use it in GitHub Desktop.
#include <M5StickC.h>
#define LGFX_AUTODETECT
#include <LovyanGFX.hpp>
static LGFX gfx;
void setup() {
M5.begin();
gfx.init();
gfx.setRotation(1);
gfx.fillScreen(TFT_BLACK);
gfx.setTextColor(TFT_WHITE, TFT_BLACK);
gfx.setFont(&fonts::lgfxJapanGothic_16);
gfx.setBrightness(100);
gfx.setTextSize(1);
gfx.setCursor(0, 0);
gfx.setTextScroll(true);
gfx.setScrollRect(0, 0, gfx.width(), gfx.height());
Serial.begin(9600);
}
void loop() {
M5.update();
if (Serial.available()) {
int inByte = Serial.read();
if (inByte == '\r')
gfx.print("\n");
else
gfx.printf("%c", inByte);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment