This lcd working via the code below with TFT LCD Mega Shield V1.0 . But problem is this, when i touch the screen just a little bit stronger, strange noises and shapes arises on screen. What is the problem you think?
#include <UTFT.h>
#include <UTouch.h>
extern uint8_t BigFont[];
UTFT myGLCD(ITDB32S, 38,39,40,41); // Remember to change the model parameter to suit your display module!
UTouch myTouch(6,5,4,3,2);
int yy=0;
int xx=0;
int tus=0;
void setup()
{
myGLCD.InitLCD();
myTouch.InitTouch();
myGLCD.clrScr();
myTouch.setPrecision(PREC_MEDIUM);
drawbutton();
}
void drawbutton()
{
myGLCD.setColor(0, 0, 255);
myGLCD.fillRoundRect (0, 0,120, 120);
myGLCD.setColor(255, 255, 255);
myGLCD.drawRoundRect (0, 0,120, 120);
myGLCD.setColor(0, 0, 255);
myGLCD.fillRoundRect (180, 0,300, 120);
myGLCD.setColor(255, 255, 255);
myGLCD.drawRoundRect (180, 0,300, 120);
myGLCD.setBackColor(VGA_BLACK);
myGLCD.setColor(VGA_LIME);
myGLCD.setFont(BigFont);
myGLCD.print("1.tus",0,60);
myGLCD.print("2.tus",180,60);
// myGLCD.printNumI(yy,20,100);
}
void drawbutton2()
{
// myGLCD.clrScr();
// myGLCD.printNumI(xx,50,200);
// myGLCD.printNumI(yy,120,200);
myGLCD.setColor(VGA_RED);
myGLCD.print("TUS:",100,200);
// void drawbutton();
myGLCD.printNumI(tus,180,200);
}
void loop()
{
long x, y;
while (myTouch.dataAvailable() == true)
{
myTouch.read();
x = myTouch.getX();
y = myTouch.getY();}
if ((x!=-1) and (y!=-1))
{
// myGLCD.drawPixel (x, y);
}
if((x<120) and (y<120))
{
tus=1;
drawbutton2();
}
if((x>=120) and (y<120) and (x<=240))
{
tus=2;
drawbutton2();
}
}
Screen also goes very well with UTFT_Demo_320x240 (C)2013 Henning Karlsen example.