Hi
I have 3.2" TFT LCD connected to a mega2560 board.
When I load the sketches included in the UTFT lib that all is OK but when I try my own sketch to learn how to control the LCD I have a problem.
The below sketch prints a text on the top of the LCD and them draws a button using the UTFT buttons lib.
The problem is that the button flickers.
Why is it doing this ? Can someone help please ?
#include <UTFT.h>
#include <UTouch.h>
#include <UTFT_Buttons.h>
// Declare which fonts we will be using
extern uint8_t SmallFont[];
extern uint8_t BigFont[];
extern uint8_t Dingbats1_XL[];
// Set up UTFT...
// Set the pins to the correct ones for your development board
// Standard Arduino Mega/Due shield : <display model>,38,39,40,41
UTFT myGLCD(ITDB32S,38,39,40,41);
// Set up UTouch...
// Set the pins to the correct ones for your development board
// Standard Arduino Mega/Due shield : 6,5,4,3,2
UTouch myTouch(6,5,4,3,2);
// Finally we set up UTFT_Buttons :)
UTFT_Buttons myButtons(&myGLCD, &myTouch);
void setup()
{
myGLCD.InitLCD();
myGLCD.clrScr();
// myGLCD.setFont(BigFont);
myTouch.InitTouch();
myTouch.setPrecision(PREC_MEDIUM);
myButtons.setTextFont(BigFont);
myButtons.setSymbolFont(Dingbats1_XL);
}
void loop()
{
int but1;
boolean default_colors = true;
but1 = myButtons.addButton(10, 50, 200, 30, "Button1");
myButtons.drawButtons();
myGLCD.setFont(BigFont);
myGLCD.setColor(VGA_RED);
myGLCD.print("LIGHT CONTROLLER", CENTER, 0);
//myGLCD.setFont(SmallFont);
//myGLCD.setColor(VGA_BLUE);
//myGLCD.print("this is a test", CENTER, 20);
}