1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
void setup() {
  Serial.begin(115200);
  delay(100);

  // 初始化背光(若要PWM請使用 ledcAttachPin + ledcWrite)
  pinMode(TFT_BL, OUTPUT);
  digitalWrite(TFT_BL, HIGH);  // 亮燈
  // 初始化 TFT
  tft.init(135, 240);  // 寬x高(注意方向)
  tft.setRotation(1);  // 可調整 0~3
  tft.fillScreen(ST77XX_BLACK);
  // 顯示測試文字
  tft.setCursor(10, 30);
  tft.setTextColor(ST77XX_GREEN);
  tft.setTextSize(2);
  tft.println("TTGO T-Display");
  tft.setTextColor(ST77XX_YELLOW);
  tft.println("Hello World!");
}

void loop() {
  // 不需要重複畫面,空迴圈
}