31 lines
672 B
Arduino
31 lines
672 B
Arduino
#include <Arduino_GFX_Library.h>
|
|
#include <Adafruit_ST7789.h>
|
|
#include <Wire.h>
|
|
|
|
#define TFT_DC D7
|
|
#define TFT_RST D9
|
|
|
|
Arduino_DataBus *bus = new Arduino_HWSPI(TFT_DC, -1);
|
|
Arduino_GFX *gfx = new Arduino_ST7789(bus, TFT_RST, 0, true, 240, 240, 0, 0);
|
|
|
|
void setup() {
|
|
gfx->begin();
|
|
|
|
gfx->fillScreen(ST77XX_GREEN);
|
|
|
|
gfx->setTextColor(ST77XX_BLACK);
|
|
|
|
}
|
|
|
|
void loop() {
|
|
// put your main code here, to run repeatedly:
|
|
drawText(20, 10, 8, "HALLO"); delay(2000);
|
|
drawText(20, 50, 8, "WORLD"); delay(2000);
|
|
}
|
|
|
|
void drawText(int width, int hight,int size, const char* text) {
|
|
gfx->setCursor(width, hight);
|
|
gfx->setTextSize(size);
|
|
gfx->println(text);
|
|
}
|