// welcome to www.lingshunlab.com
//
#include <Arduino_GFX_Library.h>
#define GFX_BL 22 // default backlight pin, you may replace DF_GFX_BL to actual backlight pin
/* More data bus class: <https://github.com/moononournation/Arduino_GFX/wiki/Data-Bus-Class> */
//Arduino_DataBus *bus = create_default_Arduino_DataBus();
Arduino_DataBus *bus = new Arduino_ESP32SPI(27 /* DC */, 5 /* CS */, 14 /* SCK */, 13 /* MOSI */, 12 /* MISO */, HSPI /* spi_num */);
/* More display class: <https://github.com/moononournation/Arduino_GFX/wiki/Display-Class> */
Arduino_GFX *gfx = new Arduino_ILI9341(
bus, 26 /* RST */, 3 /* rotation */, true /* IPS */);
// , 320 /* width */, 240 /* height */,
// 0 /* col offset 1 */, 0 /* row offset 1 */, 0, 0);
/*******************************************************************************
* End of Arduino_GFX setting
******************************************************************************/
void setup(void)
{
gfx->begin();
gfx->fillScreen(BLACK);
#ifdef GFX_BL
pinMode(GFX_BL, OUTPUT);
digitalWrite(GFX_BL, HIGH);
#endif
gfx->setCursor(10, 10);
gfx->setTextColor(RED);
gfx->println("Hello LingshunLAB.com!");
delay(5000); // 5 seconds
}
void loop()
{
gfx->setCursor(random(gfx->width()), 20+random(gfx->height()));
gfx->setTextColor(random(0xffff), random(0xffff));
gfx->setTextSize(random(6) /* x scale */, random(6) /* y scale */, random(2) /* pixel_margin */);
gfx->println("Hello LingshunLAB.com!");
delay(1000); // 1 second
}