STEP 1:
Prepare your mega2560board, TFT shield, TFT display.
Use your data cable connect mega2560 to your computer.
STEP2:
Download Arduino IDE
Download Library URTouch
Download Library UTFT
Unzip all the ZIP, install Arduino IDE in your computer
Open file folder: Arduino-nightly-libraries, put your unzip file: ’URTouch’ and ’UTFT’in libraries file folder.
STEP3:
Open arduino.exe in Arduino file folder
Click Tools-Board-Arduino Mega or Mega 2560
Click Tools-Port-COM4(Arduino Mega or Mega 2560)
And
Open file: libraries\URtouch\examples\Arduino\URTouch_Calibration\URTouch_Calibration.ino
STEP4:
find code line (#define TOUCH_ORIENTATION PORTRAIT)
Check your display size
If your display <= 3.2inch, the code should be: #define TOUCH_ORIENTATION PORTRAIT
If your display>3.2inch, the code must change to: #define TOUCH_ORIENTATION LANDSCAPE
STEP5:
find code line (UTFT myGLCD)
If your screen is 4.3inch, change code to ITDB43
If your screen is5.0inch, change code to ITDB50
If your screen is7.0inch, change code to CTE70
Save your code (Ctrl+S)
Click upload button
STEP6:
Return your Mega2560 display, you can see the calibration shows like below:
Click the touch screen,
Press the highlighted symbol +, follow the center information, hold and release
The result should be like this
You need these three lines for the next steps.
STEP7:
Open file: libraries\URtouch\examples\Arduino\URTouch\URTouchCD.h as .txt file
Change these three lines to your calibration results
Save file (Ctrl+S),
Congratulations, you can start your projects now.