A complete Arduino-compatible driver for the Goodix GT911 capacitive touch controller, supporting Arduino, ESP8266, and ESP32 boards.
Includes functions for initialization, touch point reading, interrupt handling, and display configuration.
- Clone or download this repository:
git clone https://github.com/milad-nikpendar/initGT911.git
- Copy the folder to your Arduino
librariesdirectory. - Restart the Arduino IDE.
- Alternatively, use Sketch → Include Library → Add .ZIP Library if you downloaded the ZIP.
| GT911 Pin | Connects To |
|---|---|
| SDA | SDA (I2C) |
| SCL | SCL (I2C) |
| INT | Digital pin for interrupt |
| RST | Digital pin for reset |
| VCC | 3.3V |
| GND | GND |
Note: The GT911 operates at 3.3V logic.
#include <Wire.h>
#include "initGT911.h"initGT911 touch(&Wire, GT911_I2C_ADDR_5D); // or GT911_I2C_ADDR_28void setup() {
Serial.begin(115200);
if (touch.begin(INT_PIN, RST_PIN, 400000)) {
Serial.println("GT911 Initialized!");
} else {
Serial.println("GT911 Not Found!");
}
}void loop() {
uint8_t touches = touch.touched(GT911_MODE_INTERRUPT);
if (touches > 0) {
for (uint8_t i = 0; i < touches; i++) {
GTPoint p = touch.getPoint(i);
Serial.printf("Touch %d: X=%d, Y=%d\n", i, p.x, p.y);
}
}
}| Function | Description |
|---|---|
begin(intPin, rstPin, clk) |
Initializes the GT911 with interrupt and reset pins |
touched(mode) |
Returns the number of touch points detected |
getPoint(num) |
Returns coordinates of a specific touch point |
getPoints() |
Returns array of all detected touch points |
readConfig() |
Reads current configuration from GT911 |
updateConfig() |
Updates GT911 configuration |
setupDisplay(xRes, yRes, rotation) |
Sets display resolution and rotation |
This project is licensed under the MIT License – see LICENSE for details.
Milad Nikpendar
GitHub: milad-nikpendar/initGT911
Email: milad82nikpendar@gmail.com