// ----- ST7735 -----
// Display ESP32C3
// GND --------- GND
// VCC --------- 3V3
// SCL --------- 6
// SDA --------- 7
// RST --------- 0
// DC ---------- 8
// CS ---------- 5
// BL ---------- 3V3
// Display ESP32
// GND --------- GND
// VCC --------- 3V3
// SCL --------- 18 VSPI CLK
// SDA --------- 23 VSPI MOSI
// RST(RES) --------- 4
// DC(RS) --------- 2
// CS --------- 5
// BL --------- 3V3
#include <Arduino.h>
#include <FS.h> // Font files are stored in Flash FS
#include <LittleFS.h>
#define FlashFS LittleFS
#include <SPI.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "arrow.h" // converted with big endian byte order
TFT_eSPI tft = TFT_eSPI();
TFT_eSprite arrowSprite = TFT_eSprite(&tft);
TFT_eSprite background = TFT_eSprite(&tft);
TFT_eSprite txtSprite = TFT_eSprite(&tft);
int x = 20;
void setup(void) {
Serial.begin(115200);
tft.init();
tft.setRotation(3);
// tft.setSwapBytes(true);
background.createSprite(160, 128);
arrowSprite.createSprite(72, 72);
// arrowSprite.setSwapBytes(true);
txtSprite.createSprite(80, 80);
txtSprite.setTextDatum(TR_DATUM);
txtSprite.setTextColor(TFT_WHITE, TFT_BLACK);
}
void loop() {
// background.pushImage(0,0,320,170,city);
background.fillSprite(TFT_RED);
txtSprite.fillSprite(TFT_BLACK);
txtSprite.drawString(String(x), 79, 0, 6);
txtSprite.pushToSprite(&background, 10, 5, TFT_BLACK);
arrowSprite.pushImage(0, 0, 72, 72, arrow);
arrowSprite.pushToSprite(&background, x, 45, TFT_BLACK);
background.pushSprite(0, 0);
x++;
if (x > 170) x = -100;
}