Use your data cable connect mega2560 to your computer.
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.
Open arduino.exe in Arduino file folder
Click Tools-Board-Arduino Mega or Mega 2560
Click Tools-Port-COM4(Arduino Mega or Mega 2560)
Open file: libraries\URtouch\examples\Arduino\URTouch_Calibration\URTouch_Calibration.ino
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
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
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.
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.