จอแสดงผลกลม LCD TFT 1.28 นิ้ว SPI GC9A01 SNP-00268
รหัสสินค้า: SNP-00268

จอแสดงผลกลม LCD TFT 1.28 นิ้ว SPI GC9A01 SNP-00268

1.ดาวน์โหลด และติดตั้ง Library 

ติดตั้ง Library

ArduinoIDE > Sketch > Include Library > Add .ZIP Library > หาไฟล์ที่ดาวน์โหลด

 

2.ต่ออุปกรณ์

จอแสดงผลกลม LCD TFT 1.28 นิ้ว SPI GC9A01 SNP-00268

LCD TFT 1.8  >  Arduino UNO

  • RST > 7
  • CS > 6
  • DC > 5
  • SDA > 11 
  • SCL > 13 
  • GND > GND
  • VCC > 5V 

 

2.ลงโปรแกรม 
Copy โค้ดด้านล่าง

Arduino
1#include <Adafruit_GFX.h>
2#include <Adafruit_GC9A01A.h>
3
4#define TFT_CS     6
5#define TFT_RST    7
6#define TFT_DC     5
7
8Adafruit_GC9A01A tft = Adafruit_GC9A01A(TFT_CS, TFT_DC, TFT_RST);
9
10void setup() {
11  tft.begin();
12  tft.setRotation(0);
13  tft.fillScreen(GC9A01A_BLACK);
14
15  displayMainText();
16  displaySubText();
17}
18
19void loop() {
20}
21
22void displayMainText() {
23  tft.setTextSize(4);
24  tft.setTextColor(GC9A01A_MAGENTA);
25  int16_t x1, y1;
26  uint16_t w, h;
27
28  tft.getTextBounds("Ampify", 0, 0, &x1, &y1, &w, &h);
29  tft.setCursor((240 - w) / 2, 80);
30  tft.print("Ampify");
31
32  tft.setTextSize(5);
33  tft.setTextColor(GC9A01A_CYAN);
34  tft.getTextBounds("Shop", 0, 0, &x1, &y1, &w, &h);
35  tft.setCursor((240 - w) / 2, 140);
36  tft.print("Shop");
37}
38
39void displaySubText() {
40  tft.setTextSize(1);
41  tft.setTextColor(GC9A01A_YELLOW);
42  int16_t x1, y1;
43  uint16_t w, h;
44
45  tft.getTextBounds("www.shop.snp-inno.com", 0, 0, &x1, &y1, &w, &h);
46  tft.setCursor((240 - w) / 2, 200);
47  tft.print("www.shop.snp-inno.com");
48}