Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Wire.h>
- #include <PCA9557.h> // updated to PCA9557-Arduino
- #include <TAMC_GT911.h>
- #include <LovyanGFX.hpp>
- #include "gfx_conf.h"
- #define TOUCH_SDA 19
- #define TOUCH_SCL 20
- #define TOUCH_INT -1
- #define TOUCH_RST -1
- #define TOUCH_WIDTH 800
- #define TOUCH_HEIGHT 480
- TAMC_GT911 tp = TAMC_GT911(TOUCH_SDA, TOUCH_SCL, TOUCH_INT, TOUCH_RST, TOUCH_WIDTH, TOUCH_HEIGHT);
- PCA9557 Out(0x14,&Wire);
- void setup() {
- tp.begin(0x5D); // sets up the touch instance
- tp.setRotation(ROTATION_INVERTED); // set it to landscape, 0,0 top left with usb on left
- lcd.begin(); // start the lcd
- Serial.begin(115200);
- Wire.begin(19, 20); // talk to the IO Expander chip PCA9557
- // now we're going to 'reset' the touch panel.
- Out.pinMode(0,OUTPUT);
- Out.pinMode(1,OUTPUT);
- Out.digitalWrite(0, LOW); // takes the reset pin of the GT_911 low
- Out.digitalWrite(1, LOW); // takes the ??INTE (poss interrupt) pin low
- delay(20); // wait for timings
- Out.digitalWrite(0, HIGH);// release reset pin
- delay(100); // wait for timing again
- Out.pinMode(1, INPUT);// set the intE pin as input again
- delay(2000);
- lcd.fillScreen(0x6ecb); // set it to a colour of choice
- lcd.setTextFont(&fonts::FreeMonoBold9pt7b);
- lcd.setTextSize(2);
- lcd.setTextColor(TFT_BLUE,0x6ecb);
- }
- void loop() {
- tp.read();
- if( tp.isTouched )
- {
- for(int i=0; i<tp.touches; i++){
- lcd.fillCircle(tp.points[i].x, tp.points[i].y, 10, TFT_WHITE);
- lcd.setCursor(tp.points[i].x,tp.points[i].y + 10);
- lcd.print(i);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement