使用GT911驱动的触摸屏

/ 0评 / 0

需要使用开源的一个驱动库:

git clone https://github.com/alex-code/GT911

把整个代码下载下来,然后使用:

#include "GT911.h"

GT911 tp = GT911();
void loop(){
    uint8_t touches = touch.touched(GT911_MODE_POLLING);
    if (touches) {
        GTPoint tp = touch.getPoint(0);
        // 根据屏幕的分辨率和旋转方向,调整xy
        uint16_t x = 320 - tp.y;
        uint16_t y = tp.x;
        mySerial.printf("#%d  %d,%d s:%d\n", tp.trackId, 320 - tp.y, tp.x, tp.area);
    }
}

名言语句:天欲使其灭亡,必先使其疯狂。

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注