I have a SainSmart 7" LCD Touch kit with DUE. I includes the CTE TFT LCD/SD Shield for Arduino Due. The LCD part works fine but the touch screen demo Utouch_Calibration.ino freezes .
To troubleshoot this I poured over this forum looking for similar problems but did not find any. I then proceeded to copy the code from the Utouch_Calibration.ino line by line into the working UTFT_Demo_800x480.ino when I include the first real line of code line:
UTouch myTouch( 6, 5, 4, 3, 2);
The program breaks. What ever was up on the LCD from the last run of the Demo is stuck there. I suspect that the program is banging away in a ISR and never gets out. Here is the code fragment:
// UTFT_Demo_800x480 (C)2013 Henning Karlsen
// web: http://www.henningkarlsen.com/electronics
//
// This program is a demo of how to use most of the functions
// of the library with a supported display modules.
//
// This demo was made for modules with a screen resolution
// of 800x480 pixels.
//
// This program requires the UTFT library.
//
#include <UTFT.h>
// Declare which fonts we will be using
extern uint8_t SmallFont[];
extern uint8_t BigFont[];
extern uint8_t SevenSegNumFont[];
UTFT myGLCD(CTE70,25,26,27,28); // Remember to change the model parameter to suit your display module!
#include </Users/Kurt/Documents/Arduino/libraries/UTFT_7/DUE/touch/UTouch/UTouch.h>
// Define the orientation of the touch screen. Further
// information can be found in the instructions.
#define TOUCH_ORIENTATION PORTRAIT
UTouch myTouch( 6, 5, 4, 3, 2);
// ************************************
// DO NOT EDIT ANYTHING BELOW THIS LINE
// ************************************
// Declare which fonts we will be using
extern uint8_t SmallFont[];
uint32_t cx, cy;
uint32_t rx[8], ry[8];
uint32_t clx, crx, cty, cby;
float px, py;
int dispx, dispy, text_y_center;
uint32_t calx, caly, cals;
char buf[13];
void setup()
{
randomSeed(analogRead(0));
// Setup the LCD
myGLCD.InitLCD();
myGLCD.setFont(SmallFont);
}
void loop()
{
int buf[798];
int x, x2;
int y, y2;
int r;
// Clear the screen and draw the frame
myGLCD.clrScr();
myGLCD.setFont(SmallFont);
myGLCD.setColor(255, 0, 0);
myGLCD.fillRect(0, 0, 799, 13);
myGLCD.setColor(64, 64, 64);
myGLCD.fillRect(0, 466, 799, 479);
myGLCD.setColor(255, 255, 255);
myGLCD.setBackColor(255, 0, 0);
myGLCD.print("* Universal Color TFT Display Library *", CENTER, 1);
myGLCD.setBackColor(64, 64, 64);
myGLCD.setColor(255,255,0);
myGLCD.print("<http://electronics.henningkarlsen.com>", CENTER, 467);
Thanks
Kurt