Hi all,
I have been having problem with with TFT LCD for 2 days now, I looked through so many example codes and searched every site and googled with different sentences with no luck.
So, I wrote a code to my TFT LCD and it shows what I wanted it to show but it won't stay put, its just flickering(don't know if this is the write word). I attached a video of the TFT LCD and the code.
I need your help.
#include <Adafruit_GFX.h> // Core graphics library
#include "SWTFT.h" // Hardware-specific library
#define LCD_CS A3 // Chip Select goes to Analog 3
#define LCD_CD A2 // Command/Data goes to Analog 2
#define LCD_WR A1 // LCD Write goes to Analog 1
#define LCD_RD A0 // LCD Read goes to Analog 0
#define LCD_RESET A4 // Can alternately just connect to Arduino's reset pin
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
SWTFT tft;
double value;
double value1;
void setup()
{
tft.reset();
tft.begin();
tft.fillScreen(BLUE);
value=analogRead(A5)*(3.0/1023.0);
value1=analogRead(A6)*(3.0/1023.0);
}
void loop()
{
tft.fillScreen(BLUE);
tft.drawRoundRect(10, 20, 100, 50, 5, WHITE);
tft.fillRoundRect(10, 20, 35, 50, 5, WHITE);
tft.setCursor(20, 35);
tft.setTextColor(BLUE);
tft.setTextSize(3);
tft.setTextWrap(1);
tft.print("V");
tft.setCursor(55, 35);
tft.setTextColor(WHITE);
tft.setTextSize(2);
tft.setTextWrap(1);
tft.print(value);
tft.drawRoundRect(135, 20, 100, 50, 5, WHITE);
tft.fillRoundRect(135, 20, 35, 50, 5, WHITE);
tft.setCursor(145, 35);
tft.setTextColor(BLUE);
tft.setTextSize(3);
tft.setTextWrap(1);
tft.print("T");
tft.setCursor(180, 35);
tft.setTextColor(WHITE);
tft.setTextSize(2);
tft.setTextWrap(1);
tft.print(value1);
tft.drawRoundRect(10, 85, 100, 50, 5, WHITE);
tft.fillRoundRect(10, 85, 35, 50, 5, WHITE);
tft.drawRoundRect(135, 85, 100, 50, 5, WHITE);
tft.fillRoundRect(135, 85, 35, 50, 5, WHITE);
//return;
//delay(2000);
}
20140805_203429.mp4 (860 KB)