2.4 inch TFT touch LCD Screen Module For Arduino UNO R3 SD low price jocks

New shield new problem :roll_eyes:
I buy 2-4-inch-TFT-touch-LCD-Screen-Module-For-Arduino-UNO ]:smiley:
link on pcb http://www.mcufriend.com bad :frowning:
name on pcb noname :frowning:
price very very low ]:smiley:
support not :frowning:
link on page seller have problem :frowning: https://drive.google.com/file/d/0B3hqYAvAOKllZ0M3d3E4REdiS2c/edit?usp=sharing
http://www.aliexpress.com/item/2-4-inch-TFT-touch-LCD-Screen-Module-For-Arduino-UNO-Free-Shipping/1418497586.html

On shield read 2 simple buffers on pins and 1 power suppler 5v-3.3v problem problem problem ]:smiley:
14 hours problem problem problem :grin:
Yhooo-hooo-hooo
1-one example to work :roll_eyes:

very bad code :zipper_mouth_face:
to work

Quiest:
Maybe is work code for TFT+Touch+SD ?


example bad code to work

#include "TFTLCD.h"
#include "TouchScreen.h"


//Duemilanove/Diecimila/UNO/etc ('168 and '328 chips) microcontoller:



#define YP A1  // must be an analog pin, use "An" notation!
#define XM A2  // must be an analog pin, use "An" notation!
#define YM  7 // can be a digital pin
#define XP  6  // can be a digital pin

#define TS_MINX 150
#define TS_MINY 120
#define TS_MAXX 920
#define TS_MAXY 940

// For better pressure precision, we need to know the resistance
// between X+ and X- Use any multimeter to read it
// For the one we're using, its 300 ohms across the X plate
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);

#define LCD_CS A3
#define LCD_CD A2
#define LCD_WR A1
#define LCD_RD A0 
// optional
#define LCD_RESET A4

// Color definitions
#define	BLACK           0x0000
#define	BLUE            0x001F
#define	RED             0xF800
#define	GREEN           0x07E0
#define CYAN            0x07FF
#define MAGENTA         0xF81F
#define YELLOW          0xFFE0 
#define WHITE           0xFFFF



TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);

#define BOXSIZE 40
#define PENRADIUS 3
int oldcolor, currentcolor;

void setup(void) {
  Serial.begin(9600);
  Serial.println("Paint!");
  
  tft.reset();
  
  uint16_t identifier = tft.readRegister(0x0);


  tft.initDisplay(); 
  tft.fillScreen(BLACK);
  
  tft.fillRect(0, 320-BOXSIZE, BOXSIZE, 320,MAGENTA );
  tft.fillRect(BOXSIZE, 320-BOXSIZE, BOXSIZE, 320,BLUE );
  tft.fillRect(BOXSIZE*2, 320-BOXSIZE, BOXSIZE, 320,CYAN );
  tft.fillRect(BOXSIZE*3, 320-BOXSIZE, BOXSIZE, 320, GREEN);
  tft.fillRect(BOXSIZE*4, 320-BOXSIZE, BOXSIZE, 320, YELLOW);
  tft.fillRect(BOXSIZE*5, 320-BOXSIZE, BOXSIZE, 320, RED);
 // tft.fillRect(BOXSIZE*6, 0, BOXSIZE, BOXSIZE, WHITE);
 
// tft.drawRect(0, 0, BOXSIZE, BOXSIZE, WHITE);
 currentcolor = RED;
 
  pinMode(13, OUTPUT);
}



#define MINPRESSURE 10
#define MAXPRESSURE 1000



void loop()
{
  digitalWrite(13, HIGH);
  Point p = ts.getPoint();
  digitalWrite(13, LOW);


  pinMode(XM, OUTPUT);
  pinMode(YP, OUTPUT);
  //pinMode(YM, OUTPUT);

  // we have some minimum pressure we consider 'valid'
  // pressure of 0 means no pressing!

  if (p.z > MINPRESSURE && p.z < MAXPRESSURE) {

    
    if (p.y < (TS_MINY-5)) {
      Serial.println("erase");
     // press the bottom of the screen to erase 
      tft.fillRect(0, BOXSIZE, tft.width(), tft.height()-BOXSIZE, BLACK);
      
    }
    // turn from 0->1023 to tft.width
    p.x = map(p.x, TS_MINX, TS_MAXX, tft.width(), 0);
    p.y = map(p.y, TS_MINY, TS_MAXY, tft.height(), 0);

    if (p.y < BOXSIZE) {
       oldcolor = currentcolor;
 
  
       if (p.x < BOXSIZE) { 
         currentcolor = RED; 
      //   tft.drawRect(0, 0, BOXSIZE, BOXSIZE, WHITE);
       } 
       else if (p.x < BOXSIZE*2) {
         currentcolor = YELLOW; 
       //  tft.drawRect(BOXSIZE, 0, BOXSIZE, BOXSIZE, WHITE);
       }
       else if (p.x < BOXSIZE*3) {
         currentcolor = GREEN; 
       //  tft.drawRect(BOXSIZE*2, 0, BOXSIZE, BOXSIZE, WHITE);
       }
       else if (p.x < BOXSIZE*4) {
         currentcolor = CYAN; 
      //   tft.drawRect(BOXSIZE*3, 0, BOXSIZE, BOXSIZE, WHITE);
       }
       else if (p.x < BOXSIZE*5) {
         currentcolor = BLUE; 
   //      tft.drawRect(BOXSIZE*4, 0, BOXSIZE, BOXSIZE, WHITE);
       }
       else if (p.x < BOXSIZE*6) {
         currentcolor = MAGENTA; 
       //  tft.drawRect(BOXSIZE*5, 0, BOXSIZE, BOXSIZE, WHITE);
       }
       
      // if (oldcolor != currentcolor) {
     //     if (oldcolor == RED) tft.fillRect(0, 0, BOXSIZE, BOXSIZE,MAGENTA );
    //      if (oldcolor == YELLOW) tft.fillRect(BOXSIZE, 0, BOXSIZE, BOXSIZE,BLUE );
    //      if (oldcolor == GREEN) tft.fillRect(BOXSIZE*2, 0, BOXSIZE, BOXSIZE,CYAN );
    //      if (oldcolor == CYAN) tft.fillRect(BOXSIZE*3, 0, BOXSIZE, BOXSIZE, GREEN);
    //      if (oldcolor == BLUE) tft.fillRect(BOXSIZE*4, 0, BOXSIZE, BOXSIZE, YELLOW);
    //      if (oldcolor == MAGENTA) tft.fillRect(BOXSIZE*5, 0, BOXSIZE, BOXSIZE, RED);
     //  }
    }
    if (((p.y-PENRADIUS) > BOXSIZE) && ((p.y+PENRADIUS) < tft.height())) {
      tft.fillCircle(240-p.x, 320-p.y, PENRADIUS, currentcolor);
    }
  }
}

maybe good code
arduino-2.6-7781-after12.22\libraries\TFTLCD-7781\TFTLCD??\TFTLCD.h
-----------------------------------------------------------^^^^-this is jock seller-or idiotism—:slight_smile:

TFTLCD??.zip (461 KB)

Quest? Search sequence

include....h...cpp...o

1.The current directory? 2. \arduino\ ??? \hardware\ ??? \arduino\ ??? \library\??? \arduino\ ??? \core\??? ? ? ? 3.c:\windows\system32

Where read help?

#define LCD_CS A3    
#define LCD_CD A2    
#define LCD_WR A1   
#define LCD_RD A0    
// you can also just connect RESET to the arduino RESET pin
#define LCD_RESET A4
//Duemilanove/Diecimila/UNO/etc ('168 and '328 chips) microcontoller:
// Color definitions
#define	BLACK           0x0000
#define	BLUE            0x001F
#define	RED             0xF800
#define	GREEN           0x07E0
#define CYAN            0x07FF
#define MAGENTA         0xF81F
#define YELLOW          0xFFE0 
#define WHITE           0xFFFF

#include "TFTLCD.h"

TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);

void setup(void) {
  Serial.begin(9600);
  Serial.println("8 Bit LCD test!");
  
  
  tft.reset();
  
  //uint16_t identifier = tft.readRegister(0x0);
//  if (identifier == 0x9325) 
//  {
 //   Serial.println("Found ILI9325");
 // } else if (identifier == 0x9328) 
  //{
  //  Serial.println("Found ILI9328");
  //} else 
 // {
 //   Serial.print("Unknown driver chip ");
 //   Serial.println(identifier, HEX);
  //  while (1);
  //}  
 
  tft.initDisplay();
  
  testtext(YELLOW);


}

void loop(void) {


}



void testFillRoundRect() {
  tft.fillScreen(BLACK);
  
  for (uint16_t x=tft.width(); x > 20 ; x-=6) {
    tft.fillRoundRect(tft.width()/2 -x/2, tft.height()/2 -x/2 , x, x, x/8,  tft.Color565(0, x, 0));
 }
}

void testRoundRect() {
  tft.fillScreen(BLACK);
  
  for (uint16_t x=0; x < tft.width(); x+=6) {
    tft.drawRoundRect(tft.width()/2 -x/2, tft.height()/2 -x/2 , x, x, x/8, tft.Color565(x, 0, 0));
 }
}

void testtriangles() {
  tft.fillScreen(BLACK);
  for (uint16_t i=0; i<tft.width()/2; i+=5) {
    tft.drawTriangle(tft.width()/2, tft.height()/2-i,
                     tft.width()/2-i, tft.height()/2+i,
                     tft.width()/2+i, tft.height()/2+i, tft.Color565(0, 0, i));
  }
}

void testfilltriangles() {
  tft.fillScreen(BLACK);
  
  for (uint16_t i=tft.width()/2; i>10; i-=5) {
    tft.fillTriangle(tft.width()/2, tft.height()/2-i,
                     tft.width()/2-i, tft.height()/2+i,
                     tft.width()/2+i, tft.height()/2+i, 
                     tft.Color565(0, i, i));
    tft.drawTriangle(tft.width()/2, tft.height()/2-i,
                     tft.width()/2-i, tft.height()/2+i,
                     tft.width()/2+i, tft.height()/2+i, tft.Color565(i, i, 0));    
  }
}
void testtext(uint16_t color) {
  tft.fillScreen(BLACK);
  tft.setCursor(0, 20);
  tft.setTextColor(color);
  tft.setTextSize(3);
  tft.println("Hello aitendo!");
  // tft.setTextSize(3);
  //tft.println(1234.56);
  //tft.setTextSize(3);
  //tft.println(0xDEADBEEF, HEX);
}

void testfillcircles(uint8_t radius, uint16_t color) {
  for (uint16_t x=radius; x < tft.width(); x+=radius*2) {
    for (uint16_t y=radius; y < tft.height(); y+=radius*2) {
      tft.fillCircle(x, y, radius, color);
    }
  }  
}

void testdrawcircles(uint8_t radius, uint16_t color) {
  for (uint16_t x=0; x < tft.width()+radius; x+=radius*2) {
    for (uint16_t y=0; y < tft.height()+radius; y+=radius*2) {
      tft.drawCircle(x, y, radius, color);
    }
  }  
}


void testfillrects(uint16_t color1, uint16_t color2) {
 tft.fillScreen(BLACK);
 for (uint16_t x=tft.width()-1; x > 6; x-=6) {
   //Serial.println(x, DEC);
   tft.fillRect(tft.width()/2 -x/2, tft.height()/2 -x/2 , x, x, color1);
   tft.drawRect(tft.width()/2 -x/2, tft.height()/2 -x/2 , x, x, color2);
 }
}

void testdrawrects(uint16_t color) {
 tft.fillScreen(BLACK);
 for (uint16_t x=0; x < tft.width(); x+=6) {
   tft.drawRect(tft.width()/2 -x/2, tft.height()/2 -x/2 , x, x, color);
 }
}

void testfastlines(uint16_t color1, uint16_t color2) {
   tft.fillScreen(BLACK);
   for (uint16_t y=0; y < tft.height(); y+=5) {
     tft.drawHorizontalLine(0, y, tft.width(), color1);
   }
   for (uint16_t x=0; x < tft.width(); x+=5) {
     tft.drawVerticalLine(x, 0, tft.height(), color2);
   }
  
}

void testlines(uint16_t color) {
   tft.fillScreen(BLACK);
   for (uint16_t x=0; x < tft.width(); x+=6) {
     tft.drawLine(0, 0, x, tft.height()-1, color);
   }
   for (uint16_t y=0; y < tft.height(); y+=6) {
     tft.drawLine(0, 0, tft.width()-1, y, color);
   }
   
   tft.fillScreen(BLACK);
   for (uint16_t x=0; x < tft.width(); x+=6) {
     tft.drawLine(tft.width()-1, 0, x, tft.height()-1, color);
   }
   for (uint16_t y=0; y < tft.height(); y+=6) {
     tft.drawLine(tft.width()-1, 0, 0, y, color);
   }
   
   tft.fillScreen(BLACK);
   for (uint16_t x=0; x < tft.width(); x+=6) {
     tft.drawLine(0, tft.height()-1, x, 0, color);
   }
   for (uint16_t y=0; y < tft.height(); y+=6) {
     tft.drawLine(0, tft.height()-1, tft.width()-1, y, color);
   }

   tft.fillScreen(BLACK);
   for (uint16_t x=0; x < tft.width(); x+=6) {
     tft.drawLine(tft.width()-1, tft.height()-1, x, 0, color);
   }
   for (uint16_t y=0; y < tft.height(); y+=6) {
     tft.drawLine(tft.width()-1, tft.height()-1, 0, y, color);
   }
}


void testBars() {
  uint16_t i,j;
  for(i=0; i < tft.height(); i++)
  {
    for(j=0; j < tft.width(); j++)
    {
      if(i>279) tft.writeData(WHITE);
      else if(i>239) tft.writeData(BLUE);
      else if(i>199) tft.writeData(GREEN);
      else if(i>159) tft.writeData(CYAN);
      else if(i>119) tft.writeData(RED);
      else if(i>79) tft.writeData(MAGENTA);
      else if(i>39) tft.writeData(YELLOW);
      else tft.writeData(BLACK);
    }
  }
}

Message
xin tu
Thu Mar 06 22:13:18 PST 2014
Friend:

I’m sorry for it.

The library is support by the factory.
If you think library is no effect for you.
You can find information of screen in Google website.
The ship is 7781.

Thank you for your understanding.
Best regards.
Lynn

Speed speed support only 4 day :slight_smile:

This is chip 7781 :slight_smile: - jock

  // find the TFT display
  uint16_t identifier = tft.readRegister(0x0);
  if (identifier == 0x9325) {
    Serial.println("Found ILI9325");
  } else if (identifier == 0x9328) {
    Serial.println("Found ILI9328");
  } else {
    Serial.print("Unknown driver chip ");//<-have answer
    Serial.println(identifier, HEX);
    while (1);
  }

have answer
Unknown driver chip 7783

Quest? Search sequence library in compiller arduino? #include....h..

Compiller undestand path?

include c:/workarduino/test20140307094200/tftlcdhina7783.h

include c:/workarduino/test20140307094200/touchscreenchina7783.h

http://yadi.sk/d/cWpeNS53K8S67
http://downloads.arduino.cc/arduino-1.5.6-r2-windows.exe
example:
C:\Arduino\libraries\TFTLCD\examples\tft_paint\tft_paint.pde
05.10.2013 14:46 3 615 tft_paint.pde

#include "TFTLCD.h"
#include "TouchScreen.h"


#define YP A2  
#define XM A1 
#define YM 6 
#define XP 7   


#define TS_MINX 120
#define TS_MINY 120
#define TS_MAXX 930
#define TS_MAXY 950

TouchScreen ts = TouchScreen(XP, YP, XM, YM, 400);

#define LCD_CS A3
#define LCD_CD A2
#define LCD_WR A1
#define LCD_RD A0 
#define LCD_RESET A4

// Color definitions
#define	BLACK           0x0000
#define	BLUE            0x001F
#define	RED             0xF800
#define	GREEN           0x07E0
#define CYAN            0x07FF
#define MAGENTA         0xF81F
#define YELLOW          0xFFE0 
#define WHITE           0xFFFF



TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);

#define BOXSIZE 40
#define PENRADIUS 3
int oldcolor, currentcolor;

void setup(void) {
  Serial.begin(9600);
  Serial.println("Paint!");
  
  tft.reset();

  tft.initDisplay(); 
  tft.fillScreen(BLACK);
  
  tft.fillRect(0, 0, BOXSIZE, BOXSIZE, RED);
  tft.fillRect(BOXSIZE, 0, BOXSIZE, BOXSIZE, YELLOW);
  tft.fillRect(BOXSIZE*2, 0, BOXSIZE, BOXSIZE, GREEN);
  tft.fillRect(BOXSIZE*3, 0, BOXSIZE, BOXSIZE, CYAN);
  tft.fillRect(BOXSIZE*4, 0, BOXSIZE, BOXSIZE, BLUE);
  tft.fillRect(BOXSIZE*5, 0, BOXSIZE, BOXSIZE, MAGENTA);
 // tft.fillRect(BOXSIZE*6, 0, BOXSIZE, BOXSIZE, WHITE);
 
 tft.drawRect(0, 0, BOXSIZE, BOXSIZE, WHITE);
 currentcolor = RED;
 
  pinMode(13, OUTPUT);

}


#define MINPRESSURE 10
#define MAXPRESSURE 1000




void loop()
{
  digitalWrite(13, HIGH);
  Point p = ts.getPoint();
  digitalWrite(13, LOW);

  pinMode(XM, OUTPUT);
  pinMode(YP, OUTPUT);

  if (p.z > MINPRESSURE && p.z < MAXPRESSURE) {
/*
     Serial.print(p.y);
     Serial.print(" , ");
  Serial.println(p.x);
    delay(1);
  */  
    if (p.x < (TS_MINY-5)) {
      Serial.println("erase");
     // press the bottom of the screen to erase 
      tft.fillRect(0, BOXSIZE, tft.width(), tft.height()-BOXSIZE, BLACK);
      
    }
    // turn from 0->1023 to tft.width
    p.y = map(p.y, TS_MINX, TS_MAXX, tft.width(), 0);
    p.x = map(p.x, TS_MINY, TS_MAXY, tft.height(), 0);

    if (p.x < BOXSIZE) {
       oldcolor = currentcolor;
 
  
       if (p.y < BOXSIZE) { 
         currentcolor = RED; 
         tft.drawRect(0, 0, BOXSIZE, BOXSIZE, WHITE);
       } 
       else if (p.y < BOXSIZE*2) {
         currentcolor = YELLOW; 
         tft.drawRect(BOXSIZE, 0, BOXSIZE, BOXSIZE, WHITE);
       }
       else if (p.y < BOXSIZE*3) {
         currentcolor = GREEN; 
         tft.drawRect(BOXSIZE*2, 0, BOXSIZE, BOXSIZE, WHITE);
       }
       else if (p.y < BOXSIZE*4) {
         currentcolor = CYAN; 
         tft.drawRect(BOXSIZE*3, 0, BOXSIZE, BOXSIZE, WHITE);
       }
       else if (p.y < BOXSIZE*5) {
         currentcolor = BLUE; 
         tft.drawRect(BOXSIZE*4, 0, BOXSIZE, BOXSIZE, WHITE);
       }
       else if (p.y < BOXSIZE*6) {
         currentcolor = MAGENTA; 
         tft.drawRect(BOXSIZE*5, 0, BOXSIZE, BOXSIZE, WHITE);
       }
       
       if (oldcolor != currentcolor) {
          if (oldcolor == RED) tft.fillRect(0, 0, BOXSIZE, BOXSIZE, RED);
          if (oldcolor == YELLOW) tft.fillRect(BOXSIZE, 0, BOXSIZE, BOXSIZE, YELLOW);
          if (oldcolor == GREEN) tft.fillRect(BOXSIZE*2, 0, BOXSIZE, BOXSIZE, GREEN);
          if (oldcolor == CYAN) tft.fillRect(BOXSIZE*3, 0, BOXSIZE, BOXSIZE, CYAN);
          if (oldcolor == BLUE) tft.fillRect(BOXSIZE*4, 0, BOXSIZE, BOXSIZE, BLUE);
          if (oldcolor == MAGENTA) tft.fillRect(BOXSIZE*5, 0, BOXSIZE, BOXSIZE, MAGENTA);
       }
    }
    if (((p.x-PENRADIUS) > BOXSIZE) && ((p.x+PENRADIUS) < tft.height())) {
      tft.fillCircle(p.y, p.x, PENRADIUS, currentcolor);
    }
  }
}
...
#define YP A2  
#define XM A1 
#define YM 6 
#define XP 7   
...
#define LCD_CS A3
#define LCD_CD A2
#define LCD_WR A1
#define LCD_RD A0 
#define LCD_RESET A4
...

Quest:
input and output on 1 pin?
#define LCD_CD A2 // output
#define LCD_WR A1// output
#define YP A2 //intput
#define XM A1 // input
This is work code?

Now result: 1. SD card - bed. 2. touch - bed. 3.LCD 320x240 - work - example in old compiller up. TFTLCD-7781...

only 1 example to work C:\arduino-2.6-7781-after12.22\libraries\TFTLCD778X\examples\graphicstest\graphicstest.pde

define LCD_CS A3

define LCD_CD A2

define LCD_WR A1

define LCD_RD A0

... work pin and D0...7 ... bed :sleeping:

Forum was very helpful thank you for the informative discussion. Strangeness in the distribution of input output directly in compilers such. Im sorry on my english, china, italian language.

. This is no jock. This is fact. :(

Pins in out this really now all to work?

Poll resistors screen
and
immediately output to the screen simultaneously,
it is now so fashionable?

i to write code to work

//20140208 art100  tft2.4" st7783 shield on arduino uno
// art100 write message 
//#include "st7783SD.h" // pins SD_SS-10 SD_DI-11(in) SD_DO-12(out) SD_SCK-13 no work
//#include "st7783TFT.h" //has not written
//#include "st7783TouchScreen.h" //has not written
#include "TFTLCD.h" // work
#include "TouchScreen.h" // bad but it works
//TouchScreen define
#define YP A1 //tftloop-YU pcbundertft-13 arduinoshieldLCD_WR!!! arduinouno-A1
#define XM A2 //tftloop-XR pcbundertft-14 arduinoshieldLCD_RS!!! arduinouno-A2
#define YM 7  //tftloop-XR pcbundertft-15 arduinoshieldLCD_D7 arduinouno-7
#define XP 6  //tftloop-XR pcbundertft-12 arduinoshieldLCD_D6 arduinouno-6
#define TS_MINX 150//0
#define TS_MINY 120//0
#define TS_MAXX 920//900//320      //for calibrate analog resistans ~1500om/700om
#define TS_MAXY 940//800//900//240 //for calibrate analog resistans ~1500om/700om
// For better pressure precision, we need to know the resistance// between X+ and X- Use any multimeter to read it
// For the one we're using, its 300 ohms across the X plate
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);
//TFT  define
#define LCD_RESET A4// 
#define LCD_CS A3
#define LCD_CD A2 //cmosbuffer-arduinoshieldLCD_RS!!! arduinouno-A2 this is jock :-?
#define LCD_WR A1 //cmosbuffer-arduinoshieldLCD_WR!!! arduinouno-A1 this is jock :-?
#define LCD_RD A0
// Color definitions
#define WHITE           0xFFFF
#define	BLACK           0x0000
#define	RED             0xF800
#define	BLUE            0x001F
#define	GREEN           0x07E0
#define YELLOW          0xFFE0 
TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);
//SD define //has not written
#define bordur   5
#define pen      3
//---------------------------------------
void setup(void) {
  Serial.begin(9600);
  Serial.println("Paint");
  tft.reset();
  uint16_t identifier = tft.readRegister(0x0);
  tft.initDisplay(); 
  tft.fillScreen(RED);
}
#define MINPRESSURE 10    // analog calibrate
#define MAXPRESSURE 1000  // analog calibrate
//=======================================
void loop(){
  Point p = ts.getPoint(); // get analog point
  pinMode(XM, OUTPUT); //2 chip on one pins
  pinMode(YP, OUTPUT); //2 chip on one pins
  if (p.z > MINPRESSURE && p.z < MAXPRESSURE) { // analog calibrate
    p.x = map(p.x, TS_MINX, TS_MAXX, 0, tft.width ()); // aprocsimate variable
    p.y = map(p.y, TS_MINY, TS_MAXY, 0, tft.height()); // aprocsimate variable
    
//    if (300< p.x) { // erase only on bordur  //no need have reset button
//      Serial.println("erase"); // test
//      tft.fillRect(0, 0, tft.width(), tft.height(), RED);// BLACK); //fill black
//    }
    
    // test
    Serial.print("getPoint x=");Serial.print(p.x);Serial.print(" y=");Serial.print(p.y);Serial.print(" PRESSURE=");Serial.print(p.z);  
    
    // paint
    if (((p.x)<tft.width()) && ((p.y)<tft.height())) { tft.fillRect(p.x,p.y,pen,pen,GREEN); } 
  }
}

Need critique of the code?

http://yadi.sk/d/EPYljwnIKAWUT

tft-st7783-helloworld.jpg

jock 2
tft.fillScreen(BLACK); very slow =(

// art100 write message 
//TOUCH PCB ARDUINO UNO
//YU 13 A1
//XL 12 6
//YD 15 7
//XR 14 A2     
//TFT    
//A 
//K1 
//K2 
//K3 
//K4
#include "TFTLCD.h"
//pins
#define LCD_RESET A4
#define LCD_CS A3    
#define LCD_CD A2    
#define LCD_WR A1   
#define LCD_RD A0    
// Color definitions
#define	BLACK           0x0000
#define	BLUE            0x001F
#define	RED             0xF800
#define	GREEN           0x07E0
#define CYAN            0x07FF
#define MAGENTA         0xF81F
#define YELLOW          0xFFE0 
#define WHITE           0xFFFF
TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);
const int analogInPin = A5;  // Analog input pin that the potentiometer is attached to
//const int analogInPin = A4; // :(
//const int analogInPin = A3;// :(
//const int analogInPin = A2;// :(
//const int analogInPin = A1;// :(
//const int analogInPin = A0;// :(
//const int analogInPin = A-1;// ;)
//const int analogInPin = A-2;// ;)
//const int analogInPin = A-3;// ;)
int sensorValue = 0;        // value read from the pot
int outputValue = 0;        // value output to the PWM (analog out)
//-----------------------
void setup(void) {
  Serial.begin(9600);
  Serial.println("8 Bit LCD test! more pinssssss");
  tft.reset();
  tft.initDisplay();
  tft.fillScreen(BLACK); // very slooooooow
//  testtext(YELLOW);
}
//===================
void loop(void) {
//    tft.initDisplay();
    tft.fillScreen(BLACK); // very slooooooow
    
    // read the analog in value:
  sensorValue = analogRead(analogInPin);            
  // map it to the range of the analog out:
//  outputValue = map(sensorValue, 0, 1023, 0, 255); 
  outputValue = map(sensorValue, 0, 1023, 0, 240);//lcd 320x240 
  // print the results to the serial monitor:
  Serial.print("sensor = " );  Serial.print(sensorValue);  Serial.print("\t output = ");  Serial.println(outputValue);  
  
for (uint16_t y=0; y<tft.height(); y+=10) {
  if(180<outputValue) {tft.drawHorizontalLine(  0, y, outputValue,   RED);}
  else{                tft.drawHorizontalLine(  0, y, outputValue, GREEN);}
}

 
Serial.println("tft.drawHorizontalLine(125, y, pin analog A5 only , GREEN);");
delay(1000);  
//delay(1); 

}

http://yadi.sk/d/dHTPynHxL35v6
http://yadi.sk/d/xjjgeolAL35wT

So have you managed to get this fully working?

Regards

I have the same problem with the same board.

I had bought this TFT 2.4 LCD Touch Shield for over a year, but only now I could test it. I can only see a white screen (backlight). My Arduino is a Duemilanove.

Can you help me? I just dont know where to start to make it work.

Use the libraries for the ST7781R controller. Adafruit has a 2.8" TFT with the same controller. You can use those.

Just dont use the version above. Aprarently the poster hasnt gone anywhere and they dont work with the current version of the IDE.

Thank you for the tip. I will try again with that and then return here to tell what happend.

Regards Marcos

I also bought this shield and after searching the web found this page with a working library and demos: http://www.smokeandwires.co.nz/blog/a-2-4-tft-touchscreen-shield-for-arduino/

Hope this might help some of you...

Hi, I'm newbie with displays, and after more or less difficulties, I could make the things runing, I share some observations: On arduino UNO, after mapping correctly the pins according to display design, it is working quite well with a library called TFTLCD, found in this forum: http://misc.ws/2013/11/08/touch-screen-shield-for-arduino-uno/ Connected to Arduino MEGA, is is more complicated, the TFT pins D0 to D7 must be connected to pins 22 to 29, the other pins are unchanged (MEGA has strange port arrangement connected to digital pins 0 to 13, therefore the library is not able to use the shield directly connected to MEGA). I have made the tes and it is working well also. The touchscreen share the same pins as TFT, therefore it can be used only when LCD_CS is high (LCD outputs are high impedance). To run the touchscreen alone, on UNO, this is added in setup(): pinMode(A3, OUTPUT); digitalWrite(A3, HIGH); The SD card is also working well... BUT there is a problem: the voltage given to the SD is 4.3V, and the absolute maximum voltage allowed for SD is 3.6V... DANGER to burn the SD card. This is caused by the HC245 buffer, which is not a level shifter, it has internal diodes between I/O and VCC and it push up the VCC3.3V by taking current on the arduino I/O. When Arduino is connected to USB (USB voltage on my computer=4.6V), the SD is powered at 3.9V; but with the jack, the SD has 4.3V. I am not sure how to solve that... adding level shfters somewhere... The most safe is not using the SD slot at all.

About the libraries for TFT: The author Mike McCaule, explained he has used the Adafruit TFT library, and modified several elements: capability to mirror X and Y, update the pins for UNO and MEGA, and use a faster method for rotation. Anyway, it is very slow. This display is able to show moovies at 60fps, but filling it with plain color, it takes ~0.3 second on Arduino. 320x240=76800 pixels with 16MHz processor, that means ~70 CPU clock per pixel, it seems not very optimized...

Also the tested library has poor text function (the text background is always transparent, making problems to overwrite an existing text; font management does not exist, writing bigger than 8point font is managed by zoom 2, 3, 4, ... times the 8point font, the result is slow and ugly). The display has some hardware accelerator (scrolling functions, layers management,...), but this is not used with the library; except rotation.

Does someone here has made comparaison between the available libraries?

I find the adafruit the best compromise between speed and size.
I use a dedicated arduino mini just to drive the display and SD card. The master only sends commands via serial, so the latency is reduced and its cheap to implement

One note about the last posters link - the touchscreen works perfectly with that version, so a ++!

Now the thing with this displays is that the arduino will never make them fast, unless you use a Due or upgrade to a cortex. maple would be brilliant but there are no libraries.

What i do is create the simbols using the fill reclanges and fill lines. The same functions can be used to clear only a specific area of the screen, so the result is a very fast display.

Attached is an example. This one refreshes very quicly

I will check the latest adafruit library for faster operation. Nice example casemod!

I have seen on ATMEGA2560 / 1280 data sheet, it has an external memory interface:

ATMEGA1280 pin connections to SRAM device:
Port A = Multiplexed Address low byte (A0…A7) / Data (D0…D7) <--------> Direct connection to SRAM (D0…D7) and connected to Input D of octal latch (typically “74 x 573” or equivalent) to (A0…A7) of SRAM chip
Port C = Address high byte (A8…A15) <--------> direct connection to for example SRM (A8…A15)
Port G Pin 0 = WR (Write strobe to external memory) <--------> direct connection to for example SRAM WR
Port G Pin 1 = RD (Read strobe to external memory) <--------> direct connection to for example SRAM RD
Port G Pin 2 = ALE (Address Latch Enable to external memory) <--------> Connected to G Input of octal latch (typically “74 x 573” like 74 x 573)

Using the hardware pins dedicated to communicat to external memory should make the software several times faster, as fast as using internal RAM. If I have time, I will make a try.

berni_:
I will check the latest adafruit library for faster operation. Nice example casemod!

I have seen on ATMEGA2560 / 1280 data sheet, it has an external memory interface:

ATMEGA1280 pin connections to SRAM device:
Port A = Multiplexed Address low byte (A0…A7) / Data (D0…D7) <--------> Direct connection to SRAM (D0…D7) and connected to Input D of octal latch (typically “74 x 573” or equivalent) to (A0…A7) of SRAM chip
Port C = Address high byte (A8…A15) <--------> direct connection to for example SRM (A8…A15)
Port G Pin 0 = WR (Write strobe to external memory) <--------> direct connection to for example SRAM WR
Port G Pin 1 = RD (Read strobe to external memory) <--------> direct connection to for example SRAM RD
Port G Pin 2 = ALE (Address Latch Enable to external memory) <--------> Connected to G Input of octal latch (typically “74 x 573” like 74 x 573)

Using the hardware pins dedicated to communicat to external memory should make the software several times faster, as fast as using internal RAM. If I have time, I will make a try.

Not quite sure what you’re talking about.
Performance is limited by the actual core speed, not the memory itself.

Both the Mega and the UNO are just slow, with the mega having more pins. Technically you can make the LCD on the mega a bit faster by using 16 bit interface, but just a bit.

To unlock the potential of such LCD’s you need to use an arduino due or other arm device like a stm32 or a mbed compatible device. In fact with the due you can even crank an SPI display way above the 8MHz limit an uno/mega can drive it.

But if you just want to replace a HD44780 LCD and can live with monochrome graphics on this displays a £3 arduino mini can take care of driving the display quite reasonably. Its just a lot of work writing the code

It's the hardware peripheral available on MEGA2560 micros, called "external memory interface". The WR, RD, ALE pins are manages automatically, no need to set/clear these pins by program. It is designed for connecting more SRAM directly to the uC. In the code, display memory is then addresses with pointers, exactly the same way as internal RAM. I have used that a long time ago to interface displays with 8051 micros; it should work here also.

Anyway, by using the latest Adafruit library, it is faster than before (~2x).

Touchscreen calibation
I have written a small function to calibtrate the TS with the display. In every examples I have seen, calibration is done at compile time, and require multiple trys and recompile if touch point is not aligned with TFT pixels. I was inspired by my vintage Palm, it has the same feature.
Maybe someone will save time to reuse it.
It is written for TFTLCD library (from Adafruit, June 2014) + TouchScreen (also from Adafruit)

The macros with TS calibration parameters must be changed to variables

/*//Macros replaced by variables
#define TS_MINX 150
#define TS_MINY 120
#define TS_MAXX 920
#define TS_MAXY 940*/
short TS_MINX=150;
short TS_MINY=120;
short TS_MAXX=920;
short TS_MAXY=940;

and the function, that can be called at the end of Setup() function. It works well with tftpaint example

void calibrate_TS(void){
  TSPoint p1, p2;
  int16_t temp;
  int32_t tempL;
  tft.fillScreen(BLACK);
  tft.fillCircle(10,10,4,WHITE); //show the first point
  tft.setCursor(5, 30); tft.setTextColor(WHITE);  tft.setTextSize(1);
  tft.println("Please touch the dot");
  do {  p1 = ts.getPoint(); }while((p1.z < MINPRESSURE) || (p1.z > MAXPRESSURE)); // wait touch
  pinMode(XM, OUTPUT);    pinMode(YP, OUTPUT); //Pins configures again for TFT control
  tft.fillScreen(BLACK);
  tft.fillCircle(230,310,4,WHITE); //show the 2nd point
  tft.setCursor(50, 280);
  tft.println("Please touch the other dot");
  delay (500); // debunce
  do {  p2= ts.getPoint(); }while((p2.z < MINPRESSURE )|| (p2.z > MAXPRESSURE));
  pinMode(XM, OUTPUT);    pinMode(YP, OUTPUT);
  tft.fillScreen(BLACK);
  delay (300); 
  temp=p2.x-p1.x; // Calculate the new coefficients, get X difference
  tempL=((long)temp*1024)/(tft.width()-20);
  TS_MINX=p1.x-( (tempL*10)>>10);// 10 pixels du bord
  TS_MAXX=p1.x+( (tempL*tft.width())>>10);// 220 pixels entre points
  temp=p2.y-p1.y; // ¨get Y difference
  tempL=((long)temp*1024)/(tft.height()-20);
  TS_MINY=p1.y-( (tempL*10)>>10);// 10 pixels du bord
  TS_MAXY=TS_MINY+( (tempL*tft.height())>>10);
  /*
 // For debug, show results
  tft.setCursor(5, 30);
  tft.println("After calibration: ");
  tft.print("TS_MINX= ");tft.println(TS_MINX);
  tft.print("TS_MAXX= ");tft.println(TS_MAXX);
  tft.print("TS_MINY= ");tft.println(TS_MINY);
  tft.print("TS_MAXY= ");tft.println(TS_MAXY);
  p1.x = map(p1.x, TS_MAXX,TS_MINX, tft.width(), 0);
  p1.y = map(p1.y, TS_MAXY,TS_MINY, tft.height(), 0);
  p2.x = map(p2.x, TS_MAXX,TS_MINX, tft.width(), 0);
  p2.y = map(p2.y, TS_MAXY,TS_MINY, tft.height(), 0);
  tft.println("Last touched points: ");
  tft.print("Pt 1: ");tft.print(p1.x);tft.print(" : ");tft.println(p1.y);
  tft.print("Pt 2: ");tft.print(p2.x);tft.print(" : ");tft.println(p2.y);
  // wait 1 more touch to exit finction
  do {  p2= ts.getPoint(); }while((p2.z < MINPRESSURE )|| (p2.z > MAXPRESSURE));
  pinMode(XM, OUTPUT);    pinMode(YP, OUTPUT);
*/
}