

Serial.print("\tY = ") Serial.print(p.y) TSPoint p = ts.getPoint() //Get touch point Tft.begin(ID) // assign the ID to the screen object Uint16_t ID = tft.readID() // get the screen's ID TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300) Adafruit_GFX tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET) Int tMode = 0 // the current touch mode - starts with 0 - menu screen Int mode = 0 // current display function - starts with 0 - menu screen Long tThresh = 200 // minimum time between touches Long lastTouch = millis() // last touch time for minimum delay between touches Then lookunder the RGB565 headingĪnd you'll get the hex byte representation for that colour

* click on the colour square and pick your colour. Define some colours for use in screens TSPoint tp //Touchscreen_due branch uses Point TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300) // define touch object MCUFRIEND UNO shield shares pins with the TFT. #define LCD_RESET A4 // Can alternately just connect to Arduino's reset pin #define LCD_RD A0 // LCD Read goes to Analog 0 #define LCD_WR A1 // LCD Write goes to Analog 1 #define LCD_CD A2 // Command/Data goes to Analog 2 #define LCD_CS A3 // Chip Select goes to Analog 3 #define MINPRESSURE 10 // set pressure thresholds for touchscreen
#ARDUINO UNO PINOUT MAPPING SERIAL#
With the following code I succeeded in using this shield on the Mega: /*** COPY-PASTE from Serial Terminal:Ĭonst int XP=8,XM=A2,YP=A3,YM=9 //240x320 ID=0x9341Ĭonst int TS_LEFT=116,TS_RT=936,TS_TOP=68,TS_BOT=891 The “TouchScreen_Calibr_native” example from the named library told me, that I have to use different pins for the TouchScreen on the Mega than on the Uno: XP=8, XM=A2, YP=A3, YM=9. But in my project I need a Mega 2560, so I tried to port an example to the Mega. I found that the Mcufriend-library-examples work with this shield, as long as I have it plugged onto an UNO. I have this ( link) TFT-Colour-Device (driver chip: ILI9341) with a touch screen. I try to get acquainted with touch screens.
