Go Down

Topic: HELP ERROR : SCREEN TFTLCD 3.5 ARDUINO MEGA 2560 (Read 296 times) previous topic - next topic

keriro

I have a TFTLCD 3.5 from MCUFRIEND and i use example code from : www.rinkydinkelectronics.com. after i upload the code the screen change like that picture. i hope anyone can help me :'(

keriro

I have a TFTLCD 3.5 from MCUFRIEND and i use example code from : www.rinkydinkelectronics.com. after i upload the code the screen change like that picture. i hope anyone can help me :'(

david_prentice

Life is always much easier if you post accurate photos of the pcb.   e.g. a link to the Ebay sale.

We can see a lot of information by just looking at the shape of the pcb,  copper traces and printed legends.

Ok,   I will make an inspired guess.   You have a 240x400 format screen with inverted colours and the first 32 rows (in portrait) missing.    My crystal ball says that it is ILI9327 controller.

Please paste the constructor line in your sketch.  e.g.
Code: [Select]

UTFT          myGLCD(ILI9327, 38, 39, 40, 41);
 

David.

keriro

https://www.ebay.com/itm/3-5-inch-TFT-LCD-touch-screen-Module-for-Arduino-mega2560-mega-2560-r3/162102438173?epid=506781222&hash=item25be0ee91d:g:oD0AAOSwB-1Yt8xt

maybe like this. i try your code but the LCD change white screen.

david_prentice

Does the item on your desk match the photos in the link?
In what way(s) does it differ?
Can you measure the dimensions of the pcb?

David.

keriro

Does the item on your desk match the photos in the link?
In what way(s) does it differ?
Can you measure the dimensions of the pcb?

David.
there a text in the PCB it say" 3.6" TFTLCD for aruino mega 2560", the dimension 2.5 inch x 3.9 inch.

david_prentice

Why not either take a photo of your pcb?
Or look through Ebay adverts for 3.6" displays until you find one with ACCURATE photos that match the item on your desk.

David.

keriro

Why not either take a photo of your pcb?
Or look through Ebay adverts for 3.6" displays until you find one with ACCURATE photos that match the item on your desk.

David.
i tried but i still cannot find it
- https://www.dropbox.com/s/pos9qpsell19nyp/IMG_20171112_012054.jpg?dl=0
- https://www.dropbox.com/s/pos9qpsell19nyp/IMG_20171112_012054.jpg?dl=0

david_prentice

Seriously.   What is the point of a photo of a Mega2560?
What is the point of a photo of a screen?

Your JPEGs are both the same.   I need to see the red pcb.

Quote
We can see a lot of information by just looking at the shape of the pcb,  copper traces and printed legends.
Yes,  your screen looks like 240x400 "letterbox" shape.

David.

keriro

Seriously.   What is the point of a photo of a Mega2560?
What is the point of a photo of a screen?

Your JPEGs are both the same.   I need to see the red pcb.

Yes,  your screen looks like 240x400 "letterbox" shape.

David.
yeah i try the example demo for 240x400 with CTE32HR, it's works. but the problem is like eror.jpg that i send before

david_prentice

I give up.    What is a CTE32HR ?

I have tried to be helpful.   You seem determined to be as obtuse as possible.

David.

keriro

I give up.    What is a CTE32HR ?

I have tried to be helpful.   You seem determined to be as obtuse as possible.

David.
Okay thank you for answering.

i mean this : UTFT myGLCD(CTE32HR,38,39,40,41);

i try this code :

// UTFT_Demo_400x240
// Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved
// web: http://www.RinkyDinkElectronics.com/
//
// 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 400x240 pixels.
//
// This program requires the UTFT library.
//

#include <UTFT.h>

// Declare which fonts we will be using
extern uint8_t SmallFont[];

// Set the pins to the correct ones for your development shield
// ------------------------------------------------------------
// Arduino Uno / 2009:
// -------------------
// Standard Arduino Uno/2009 shield            : <display model>,A5,A4,A3,A2
// DisplayModule Arduino Uno TFT shield        : <display model>,A5,A4,A3,A2
//
// Arduino Mega:
// -------------------
// Standard Arduino Mega/Due shield            : <display model>,38,39,40,41
// CTE TFT LCD/SD Shield for Arduino Mega      : <display model>,38,39,40,41
//
// Remember to change the model parameter to suit your display module!
UTFT myGLCD(CTE32HR,38,39,40,41);

void setup()
{
  randomSeed(analogRead(0));
 
// Setup the LCD
  myGLCD.InitLCD();
  myGLCD.setFont(SmallFont);
}

void loop()
{
  int buf[398];
  int x, x2;
  int y, y2;
  int r;

// Clear the screen and draw the frame
  myGLCD.clrScr();

  myGLCD.setColor(255, 0, 0);
  myGLCD.fillRect(0, 0, 399, 13);
  myGLCD.setColor(64, 64, 64);
  myGLCD.fillRect(0, 226, 399, 239);
  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://www.RinkyDinkElectronics.com/ >", CENTER, 227);

  myGLCD.setColor(0, 0, 255);
  myGLCD.drawRect(0, 14, 399, 225);

// Draw crosshairs
  myGLCD.setColor(0, 0, 255);
  myGLCD.setBackColor(0, 0, 0);
  myGLCD.drawLine(199, 15, 199, 224);
  myGLCD.drawLine(1, 119, 398, 119);
  for (int i=9; i<390; i+=10)
    myGLCD.drawLine(i, 117, i, 121);
  for (int i=19; i<220; i+=10)
    myGLCD.drawLine(197, i, 201, i);

// Draw sin-, cos- and tan-lines 
  myGLCD.setColor(0,255,255);
  myGLCD.print("Sin", 5, 15);
  for (int i=1; i<398; i++)
  {
    myGLCD.drawPixel(i,119+(sin(((i*0.9)*3.14)/180)*95));
  }
 
  myGLCD.setColor(255,0,0);
  myGLCD.print("Cos", 5, 27);
  for (int i=1; i<398; i++)
  {
    myGLCD.drawPixel(i,119+(cos(((i*0.9)*3.14)/180)*95));
  }

  myGLCD.setColor(255,255,0);
  myGLCD.print("Tan", 5, 39);
  for (int i=1; i<398; i++)
  {
    y=119+(tan(((i*0.9)*3.14)/180));
    if ((y>15) && (y<224))
    myGLCD.drawPixel(i,y);
  }

  delay(2000);

  myGLCD.setColor(0,0,0);
  myGLCD.fillRect(1,15,398,224);
  myGLCD.setColor(0, 0, 255);
  myGLCD.setBackColor(0, 0, 0);
  myGLCD.drawLine(199, 15, 199, 224);
  myGLCD.drawLine(1, 119, 398, 119);

// Draw a moving sinewave
  x=1;
  for (int i=1; i<(398*20); i++)
  {
    x++;
    if (x==399)
      x=1;
    if (i>399)
    {
      if ((x==199)||(buf[x-1]==119))
        myGLCD.setColor(0,0,255);
      else
        myGLCD.setColor(0,0,0);
      myGLCD.drawPixel(x,buf[x-1]);
    }
    myGLCD.setColor(0,255,255);
    y=119+(sin(((i)*3.14)/180)*(90-(i / 100)));
    myGLCD.drawPixel(x,y);
    buf[x-1]=y;
  }

  delay(2000);
 
  myGLCD.setColor(0,0,0);
  myGLCD.fillRect(1,15,398,224);

// Draw some filled rectangles
  for (int i=1; i<6; i++)
  {
    switch (i)
    {
      case 1:
        myGLCD.setColor(255,0,255);
        break;
      case 2:
        myGLCD.setColor(255,0,0);
        break;
      case 3:
        myGLCD.setColor(0,255,0);
        break;
      case 4:
        myGLCD.setColor(0,0,255);
        break;
      case 5:
        myGLCD.setColor(255,255,0);
        break;
    }
    myGLCD.fillRect(110+(i*20), 30+(i*20), 170+(i*20), 90+(i*20));
  }

  delay(2000);
 
  myGLCD.setColor(0,0,0);
  myGLCD.fillRect(1,15,398,224);

// Draw some filled, rounded rectangles
  for (int i=1; i<6; i++)
  {
    switch (i)
    {
      case 1:
        myGLCD.setColor(255,0,255);
        break;
      case 2:
        myGLCD.setColor(255,0,0);
        break;
      case 3:
        myGLCD.setColor(0,255,0);
        break;
      case 4:
        myGLCD.setColor(0,0,255);
        break;
      case 5:
        myGLCD.setColor(255,255,0);
        break;
    }
    myGLCD.fillRoundRect(230-(i*20), 30+(i*20), 290-(i*20), 90+(i*20));
  }
 
  delay(2000);
 
  myGLCD.setColor(0,0,0);
  myGLCD.fillRect(1,15,398,224);

// Draw some filled circles
  for (int i=1; i<6; i++)
  {
    switch (i)
    {
      case 1:
        myGLCD.setColor(255,0,255);
        break;
      case 2:
        myGLCD.setColor(255,0,0);
        break;
      case 3:
        myGLCD.setColor(0,255,0);
        break;
      case 4:
        myGLCD.setColor(0,0,255);
        break;
      case 5:
        myGLCD.setColor(255,255,0);
        break;
    }
    myGLCD.fillCircle(110+(i*30),60+(i*20), 30);
  }
 
  delay(2000);
 
  myGLCD.setColor(0,0,0);
  myGLCD.fillRect(1,15,398,224);

// Draw some lines in a pattern
  myGLCD.setColor (255,0,0);
  for (int i=15; i<224; i+=5)
  {
    myGLCD.drawLine(1, i, (i*1.77)-10, 224);
  }
  myGLCD.setColor (255,0,0);
  for (int i=224; i>15; i-=5)
  {
    myGLCD.drawLine(398, i, (i*1.77)-11, 15);
  }
  myGLCD.setColor (0,255,255);
  for (int i=224; i>15; i-=5)
  {
    myGLCD.drawLine(1, i, 411-(i*1.77), 15);
  }
  myGLCD.setColor (0,255,255);
  for (int i=15; i<224; i+=5)
  {
    myGLCD.drawLine(398, i, 410-(i*1.77), 224);
  }
 
  delay(2000);
 
  myGLCD.setColor(0,0,0);
  myGLCD.fillRect(1,15,398,224);

// Draw some random circles
  for (int i=0; i<100; i++)
  {
    myGLCD.setColor(random(255), random(255), random(255));
    x=32+random(336);
    y=45+random(146);
    r=random(30);
    myGLCD.drawCircle(x, y, r);
  }

  delay(2000);
 
  myGLCD.setColor(0,0,0);
  myGLCD.fillRect(1,15,398,224);

// Draw some random rectangles
  for (int i=0; i<100; i++)
  {
    myGLCD.setColor(random(255), random(255), random(255));
    x=2+random(396);
    y=16+random(207);
    x2=2+random(396);
    y2=16+random(207);
    myGLCD.drawRect(x, y, x2, y2);
  }

  delay(2000);
 
  myGLCD.setColor(0,0,0);
  myGLCD.fillRect(1,15,398,224);

// Draw some random rounded rectangles
  for (int i=0; i<100; i++)
  {
    myGLCD.setColor(random(255), random(255), random(255));
    x=2+random(396);
    y=16+random(207);
    x2=2+random(396);
    y2=16+random(207);
    myGLCD.drawRoundRect(x, y, x2, y2);
  }

  delay(2000);
 
  myGLCD.setColor(0,0,0);
  myGLCD.fillRect(1,15,398,224);

  for (int i=0; i<100; i++)
  {
    myGLCD.setColor(random(255), random(255), random(255));
    x=2+random(396);
    y=16+random(209);
    x2=2+random(396);
    y2=16+random(209);
    myGLCD.drawLine(x, y, x2, y2);
  }

  delay(2000);
 
  myGLCD.setColor(0,0,0);
  myGLCD.fillRect(1,15,398,224);

  for (int i=0; i<10000; i++)
  {
    myGLCD.setColor(random(255), random(255), random(255));
    myGLCD.drawPixel(2+random(396), 16+random(209));
  }

  delay(2000);

  myGLCD.fillScr(0, 0, 255);
  myGLCD.setColor(255, 0, 0);
  myGLCD.fillRoundRect(120, 70, 279, 169);
 
  myGLCD.setColor(255, 255, 255);
  myGLCD.setBackColor(255, 0, 0);
  myGLCD.print("That's it!", CENTER, 93);
  myGLCD.print("Restarting in a", CENTER, 119);
  myGLCD.print("few seconds...", CENTER, 132);
 
  myGLCD.setColor(0, 255, 0);
  myGLCD.setBackColor(0, 0, 255);
  myGLCD.print("Runtime: (msecs)", CENTER, 210);
  myGLCD.printNumI(millis(), CENTER, 225);
 
  delay (10000);
}

Go Up