Text wird auf Display nur ganz kurz angezeigt

Hey Leute auf meinem Display wird der Text nur ganz kurz angezeigt. Während dem hochladen vom Sketch wird es andauernd angezeigt und sobald es hochgeladen wurde erscheint der Text nur ganz kurz und verschwindet danach. Hat jemand Lösungsvorschläge? :smiley:

Ich habe ein 9 Zoll SSD1963 TFT LCD Touch Display.
Hier ist der Link: 9"TFT LCD Module Touch Display w/SSD1963 Controller Board for Arduino

Und hier ist der Code:

#include <UTFT.h>
extern uint8_t SmallFont[];
UTFT myGLCD(SSD1963_800480, 38, 39, 40, 41);

void setup()
{
myGLCD.InitLCD();
  myGLCD.clrScr(); 
  myGLCD.setColor(VGA_RED);
  myGLCD.setFont(SmallFont);
}

void loop() {
   myGLCD.print("Anzeige Test", CENTER, CENTER);
  delay(100); 
}



Im englischen Teil des Forum müssen die Beiträge und Diskussionen in englischer Sprache verfasst werden. Deswegen wurde diese Diskussion in den deutschen Teil des Forums verschoben.

mfg ein Moderator.

1 Like

Was passiert, wenn du die Print Anweisung von der loop() in setup() verschiebst?

Genau dasselbe es ändert nichts daran

Hast Du die serielle Konsole offen? Kann es sein, dass der Controller permanent neu startet?

Hey die Serielle Konsole habe ich nicht offen aber mir ist folgendes aufgefallen.
Es gibt ein Code vom Hersteller der einwandfrei funktioniert wenn ich diesen Code rauf spiele leuchtet die TX LED auf meinem arduino due und bleibt so. Bei meinem Code jedoch leuchtet die TX LED nur während dem Hochladen und erlischt wenn mein Code fertig hochgeladen wurde. Was genau bedeutet das ?

Dann poste doch mal den Sketch, der bei dir funktioniert.
Normalerweise blinkt die TX Led beim hochladen, meist sehr schnell und geht dann aus.

Hier ist der funktionierende Sketch vom Hersteller:

//web: http://www.buydisplay.com
//EastRising Technology Co.,LTD
//Examples for ER-TFTM090-1 with Capacitive Touch Panel 
// 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 800x480 pixels.
// This program requires the UTFT library.
//
#include <stdint.h>
#include <UTFT.h>
#include <SPI.h>
#include <Wire.h>


uint8_t addr  = 0x5d;  //CTP IIC ADDRESS
// Declare which fonts we will be using
extern uint8_t SmallFont[];

// Set the pins to the correct ones for your development shield
// Standard Arduino Mega/Due shield       

#define GT9271_RESET 41   //CTP RESET
#define GT9271_INT   48   //CTP  INT

UTFT myGLCD(SSD1963_800480,38,39,40,41);  //(byte model, int RS, int WR, int CS, int RST)

unsigned char  GTP_CFG_DATA[] =
{

0x00,0x20,0x03,0xE0,0x01,0x0A,0x0D,0x00,
0x01,0x0A,0x28,0x0F,0x50,0x32,0x03,0x08,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x8E,0x2E,0x88,0x23,0x21,
0x31,0x0D,0x00,0x00,0x00,0x01,0x03,0x1D,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x1E,0x50,0x94,0xC5,0x02,
0x07,0x00,0x00,0x04,0x80,0x21,0x00,0x6B,
0x28,0x00,0x59,0x31,0x00,0x4B,0x3B,0x00,
0x3F,0x48,0x00,0x3F,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x15,0x14,0x11,0x10,0x0F,0x0E,0x0D,0x0C,
0x09,0x08,0x07,0x06,0x05,0x04,0x01,0x00,
0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,
0x04,0x06,0x07,0x08,0x0A,0x0C,0x0D,0x0F,
0x10,0x11,0x12,0x13,0x19,0x1B,0x1C,0x1E,
0x1F,0x20,0x21,0x22,0x23,0x24,0x25,0x26,
0x27,0x28,0xFF,0xFF,0xFF,0xFF,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x4D,0x01
};


struct TouchLocation
{
  uint16_t x;
  uint16_t y;
};
TouchLocation touchLocations[10];

void inttostr(uint16_t value,uint8_t *str);
uint8_t GT9271_Send_Cfg(uint8_t * buf,uint16_t cfg_len);
void writeGT9271TouchRegister( uint16_t regAddr,uint8_t *val, uint16_t cnt);
uint8_t readGT9271TouchAddr( uint16_t regAddr, uint8_t * pBuf, uint8_t len );
uint8_t readGT9271TouchLocation( TouchLocation * pLoc, uint8_t num );
uint32_t dist(const TouchLocation & loc);
uint32_t dist(const TouchLocation & loc1, const TouchLocation & loc2);
bool sameLoc( const TouchLocation & loc, const TouchLocation & loc2 );


uint8_t buf[80];


uint8_t GT9271_Send_Cfg(uint8_t * buf,uint16_t cfg_len)
{
	//uint8_t ret=0;
	uint8_t retry=0;
	for(retry=0;retry<2;retry++)
	{
		writeGT9271TouchRegister(0x8047,buf,cfg_len);
		//if(ret==0)break;
		delay(10);	 
	}
	//return ret;
}


void writeGT9271TouchRegister( uint16_t regAddr,uint8_t *val, uint16_t cnt)
{	uint16_t i=0;
  Wire.beginTransmission(addr);
   Wire.write( regAddr>>8 );  // register 0
  Wire.write( regAddr);  // register 0 
	for(i=0;i<cnt;i++,val++)//data
	{		
          Wire.write( *val );  // value
	}
  uint8_t retVal = Wire.endTransmission(); 
}



uint8_t readGT9271TouchAddr( uint16_t regAddr, uint8_t * pBuf, uint8_t len )
{
  Wire.beginTransmission(addr);
  Wire.write( regAddr>>8 );  // register 0
  Wire.write( regAddr);  // register 0  
  uint8_t retVal = Wire.endTransmission();
  
  uint8_t returned = Wire.requestFrom(addr, len);    // request 1 bytes from slave device #2
  
  uint8_t i;
  for (i = 0; (i < len) && Wire.available(); i++)
  
  {
    pBuf[i] = Wire.read();
  }
  
  return i;
}

uint8_t readGT9271TouchLocation( TouchLocation * pLoc, uint8_t num )
{
  uint8_t retVal;
  uint8_t i;
  uint8_t k;
  uint8_t  ss[1];
  
  do
  {  
    
    if (!pLoc) break; // must have a buffer
    if (!num)  break; // must be able to take at least one
     ss[0]=0;
      readGT9271TouchAddr( 0x814e, ss, 1);
      uint8_t status=ss[0];

    if ((status & 0x0f) == 0) break; // no points detected
    uint8_t hitPoints = status & 0x0f;
    
    Serial.print("number of hit points = ");
    Serial.println( hitPoints );
    
   uint8_t tbuf[32]; uint8_t tbuf1[32];uint8_t tbuf2[16];  
    readGT9271TouchAddr( 0x8150, tbuf, 32);
    readGT9271TouchAddr( 0x8150+32, tbuf1, 32);
    readGT9271TouchAddr( 0x8150+64, tbuf2,16);
    
      if(hitPoints<=4)
            {   
              for (k=0,i = 0; (i <  4*8)&&(k < num); k++, i += 8)
              {
                pLoc[k].x = tbuf[i+1] << 8 | tbuf[i+0];
                pLoc[k].y = tbuf[i+3] << 8 | tbuf[i+2];
              }   
            }
        if(hitPoints>4)   
            {  
               for (k=0,i = 0; (i <  4*8)&&(k < num); k++, i += 8)
              {
                pLoc[k].x = tbuf[i+1] << 8 | tbuf[i+0];
                pLoc[k].y = tbuf[i+3] << 8 | tbuf[i+2];
              }               
              
              for (k=4,i = 0; (i <  4*8)&&(k < num); k++, i += 8)
              {
                pLoc[k].x = tbuf1[i+1] << 8 | tbuf1[i+0];
                pLoc[k].y = tbuf1[i+3] << 8 | tbuf1[i+2];
              }   
            } 
            
          if(hitPoints>8)   
            {  
                for (k=0,i = 0; (i <  4*8)&&(k < num); k++, i += 8)
              {
                pLoc[k].x = tbuf[i+1] << 8 | tbuf[i+0];
                pLoc[k].y = tbuf[i+3] << 8 | tbuf[i+2];
              }               
              
              for (k=4,i = 0; (i <  4*8)&&(k < num); k++, i += 8)
              {
                pLoc[k].x = tbuf1[i+1] << 8 | tbuf1[i+0];
                pLoc[k].y = tbuf1[i+3] << 8 | tbuf1[i+2];
              }                          
             
              for (k=8,i = 0; (i <  2*8)&&(k < num); k++, i += 8)
              {
                pLoc[k].x = tbuf2[i+1] << 8 | tbuf2[i+0];
                pLoc[k].y = tbuf2[i+3] << 8 | tbuf2[i+2];
              }   
            }       

            
    
    retVal = hitPoints;
    
  } while (0);
  
    ss[0]=0;
    writeGT9271TouchRegister( 0x814e,ss,1); 
    delay(2);  
  return retVal;
}



void setup()
{
  randomSeed(analogRead(0));
  
   Serial.begin(9600);
  Wire.begin();        // join i2c bus (address optional for master)
  

   delay(300);  
       pinMode(GT9271_RESET, OUTPUT); 
    pinMode     (GT9271_INT, OUTPUT);
    digitalWrite(GT9271_RESET, LOW);
      delay(20);  
    digitalWrite(GT9271_INT, LOW);
    delay(50);
     digitalWrite(GT9271_RESET, HIGH);
     delay(100);  
    pinMode     (GT9271_INT, INPUT);
     delay(100);  
          
     uint8_t re=GT9271_Send_Cfg((uint8_t*)GTP_CFG_DATA,sizeof(GTP_CFG_DATA));
      
       pinMode(GT9271_RESET, OUTPUT); 
    pinMode     (GT9271_INT, OUTPUT);
    digitalWrite(GT9271_RESET, LOW);
      delay(20);  
    digitalWrite(GT9271_INT, LOW);
    delay(50);
     digitalWrite(GT9271_RESET, HIGH);
     delay(100);  
    pinMode     (GT9271_INT, INPUT);
     delay(100);  
          
     re=GT9271_Send_Cfg((uint8_t*)GTP_CFG_DATA,sizeof(GTP_CFG_DATA));
       
     
         uint8_t bb[2];
 	 readGT9271TouchAddr(0x8047,bb,2);  
         while(bb[1]!=32)
         { Serial.println("Capacitive touch screen initialized failure");  
       pinMode(GT9271_RESET, OUTPUT); 
    pinMode     (GT9271_INT, OUTPUT);
    digitalWrite(GT9271_RESET, LOW);
      delay(20);  
    digitalWrite(GT9271_INT, LOW);
    delay(50);
     digitalWrite(GT9271_RESET, HIGH);
     delay(100);  
    pinMode     (GT9271_INT, INPUT);
     delay(100);  

      
     uint8_t re=GT9271_Send_Cfg((uint8_t*)GTP_CFG_DATA,sizeof(GTP_CFG_DATA));
   
         }
    
     Serial.println("Capacitive touch screen initialized success");  
    
    
 // Setup the LCD
  myGLCD.InitLCD();
 // -------------------------------------------------------------
  pinMode(8, OUTPUT);  //backlight 
  digitalWrite(8, HIGH);//on
// -------------------------------------------------------------
 
 
  myGLCD.setFont(SmallFont);
  
  
 /*
 
         myGLCD.setColor(0, 0, 0);
         myGLCD.fillRect(0, 0, 799, 479);
         uint8_t bb[32];
	 readGT9271TouchAddr(0x8047,bb,32);  
         myGLCD.setColor(0, 255, 0);
         if (bb[1]==32)Serial.println("Capacitive touch screen initialized success");
         else
        { myGLCD.print("* Capacitive touch screen initialized failure,Please,Press the reset button Reset again ",LEFT , 1);
          while(1);
        }
    */
       /*  
           myGLCD.setColor(0, 0, 0);
         myGLCD.fillRect(0, 0, 799, 479);
         uint8_t bb[32];
	 readGT9271TouchAddr(0x8047,bb,32);  
     
         myGLCD.setColor(255, 0, 0);
         myGLCD.print("* www.buydiplay.com   Read CFG",LEFT , 3);   
     	  
	uint8_t in=0; 
  
	 while(in<16)				
		{

         snprintf((char*)buf,sizeof(buf),"(%3d)",bb[in]);
          myGLCD.print((const char *)buf,CENTER,20+16*in);
                in++;
		}

    delay(3000);  
  */
}

uint32_t dist(const TouchLocation & loc)
{
  uint32_t retVal = 0;
  
  uint32_t x = loc.x;
  uint32_t y = loc.y;
  
  retVal = x*x + y*y;
  
  return retVal;
}
uint32_t dist(const TouchLocation & loc1, const TouchLocation & loc2)
{
  uint32_t retVal = 0;
  
  uint32_t x = loc1.x - loc2.x;
  uint32_t y = loc1.y - loc2.y;
  
  retVal = sqrt(x*x + y*y);
  
  return retVal;
}

bool sameLoc( const TouchLocation & loc, const TouchLocation & loc2 )
{
  return dist(loc,loc2) < 50;
}


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

// Clear the screen and draw the frame
  myGLCD.clrScr();
  
 uint8_t flag = 1;
  static uint16_t w = 800;
  static uint16_t h = 480;
  
  float xScale = 1024.0F/w;
  float yScale = 1024.0F/h;
  

  uint32_t thisTouchTime = millis();
  uint8_t i=0;   
  
  static 
  uint32_t lastTouchTime = thisTouchTime;
 
 
   
         myGLCD.setColor(0, 0, 0);
         myGLCD.fillRect(0, 0, 799, 479);
         myGLCD.setColor(255, 0, 0);
         myGLCD.print("* www.buydiplay.com  Capacitive touch screen test.Please touch the screen!", CENTER, 1);   
         myGLCD.setColor(0, 255, 255);
         myGLCD.print("*EXIT", LEFT, 460); 
          myGLCD.setColor(0, 255, 0);
          myGLCD.print("*CLEAR",RIGHT, 460);
 
while(flag)
 {  
    /* Wait around for touch events */
  
  /*  pinMode     (GT9271_INT, INPUT);  
    uint8_t st=digitalRead(GT9271_INT); 
    if(!st)   //Hardware touch interrupt
    */
       
       uint8_t  ss[1];
      readGT9271TouchAddr( 0x814e, ss, 1);
      uint8_t status=ss[0];
    if ((status & 0x80) != 0)  // touch status   Software touch interrupt  
    

    {   
      Serial.println("Touch: ");
      
       uint8_t count = readGT9271TouchLocation( touchLocations, 10 );
            
      //static uint8_t lastCount = count;
  
     if (count)
      {
        static TouchLocation lastTouch = touchLocations[0];
        
        if (((thisTouchTime - lastTouchTime) > 10000) && sameLoc( touchLocations[0],lastTouch ) )
        {
            myGLCD.setColor(0, 0, 0);
            myGLCD.fillRect(0, 0, 799, 479);
          lastTouchTime = thisTouchTime; 
   
        }
      
        Serial.print("Time delta = ");
        Serial.print(thisTouchTime - lastTouchTime);
        Serial.print(", dist = ");
        Serial.println( dist(touchLocations[0],lastTouch) );
        
        lastTouch = touchLocations[0];
        
        Serial.println("Locations: ");
        
        for (i = 0; i < count; i++)
        {

     //    myGLCD.setColor(255, 0, 0);
     //     myGLCD.print("* www.buydiplay.com  Capacitive touch screen test.Please touch the screen!", CENTER, 1);
          snprintf((char*)buf,sizeof(buf),"(%3d,%3d)",touchLocations[i].x,touchLocations[i].y);
          myGLCD.print((const char *)buf,CENTER,280+16*i);

        if(touchLocations[i].x>=3&&touchLocations[i].x<=40&&touchLocations[i].y>=450&&touchLocations[i].y<=480 )flag=0;

        if(i==0) 
        myGLCD.setColor(255, 0, 0),
        myGLCD.fillCircle(touchLocations[i].x,touchLocations[i].y, 4); 

        else if(i==1)  
         myGLCD.setColor(0, 255, 0),
        myGLCD.fillCircle(touchLocations[i].x,touchLocations[i].y, 4); 

        else if(i==2) 
         myGLCD.setColor(0, 0, 255), 
        myGLCD.fillCircle(touchLocations[i].x,touchLocations[i].y, 4 );   
               
        else if(i==3) 
         myGLCD.setColor(255, 255, 255),     
        myGLCD.fillCircle(touchLocations[i].x,touchLocations[i].y, 4 ); 

         else if(i==4) 
         myGLCD.setColor(0, 255, 255),       
         myGLCD.fillCircle(touchLocations[i].x,touchLocations[i].y, 4 ); 
         
           else if(i==5) 
         myGLCD.setColor(255, 255,0 ),       
         myGLCD.fillCircle(touchLocations[i].x,touchLocations[i].y, 4 );   
         
            else if(i==6) 
         myGLCD.setColor(255,0,255),       
         myGLCD.fillCircle(touchLocations[i].x,touchLocations[i].y, 4 );            
         
              else if(i==7) 
         myGLCD.setColor(50,0,150),       
         myGLCD.fillCircle(touchLocations[i].x,touchLocations[i].y, 4 );         
         
                 else if(i==8) 
         myGLCD.setColor(150,100,0),       
         myGLCD.fillCircle(touchLocations[i].x,touchLocations[i].y, 4 );  
   
                 else if(i==9) 
         myGLCD.setColor(0,150,50),       
         myGLCD.fillCircle(touchLocations[i].x,touchLocations[i].y, 4 );        
          
          
           if(touchLocations[i].x>=3&&touchLocations[i].x>=750&&touchLocations[i].y>=450&&touchLocations[i].y<=480 )
           { myGLCD.setColor(0, 0, 0);
            myGLCD.fillRect(0, 0, 799, 479);
         myGLCD.setColor(255, 0, 0);
          myGLCD.print("* www.buydiplay.com  Capacitive touch screen test.Please touch the screen!", CENTER, 1);   
         myGLCD.setColor(0, 255, 255);
          myGLCD.print("*EXIT", LEFT, 460); 
         myGLCD.setColor(0, 255, 0);
          myGLCD.print("*CLEAR",RIGHT, 460);
             
           }
         
    
        }
      }
        
    }
   
  }

  myGLCD.clrScr();
  myGLCD.setColor(255, 0, 0);
  myGLCD.fillRect(0, 0, 799, 13);
  myGLCD.setColor(64, 64, 64);
  myGLCD.fillRect(0, 466, 799, 479);
  myGLCD.setColor(255, 255, 255);
  myGLCD.setBackColor(255, 0, 0);
  myGLCD.print("* EastRising Technology *", CENTER, 1);
  myGLCD.setBackColor(64, 64, 64);
  myGLCD.setColor(255,255,0);
  myGLCD.print(" http://www.buydisplay.com", CENTER, 467);

  myGLCD.setColor(0, 0, 255);
  myGLCD.drawRect(0, 14, 799, 465);

// Draw crosshairs
  myGLCD.setColor(0, 0, 255);
  myGLCD.setBackColor(0, 0, 0);
  myGLCD.drawLine(399, 15, 399, 464);
  myGLCD.drawLine(1, 239, 798, 239);
  for (int i=9; i<790; i+=10)
    myGLCD.drawLine(i, 237, i, 242);
  for (int i=19; i<470; i+=10)
    myGLCD.drawLine(397, i, 402, i);

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

  myGLCD.setColor(255,255,0);
  myGLCD.print("Tan", 5, 39);
  for (int i=1; i<798; i++)
  {
    myGLCD.drawPixel(i,239+(tan(((i*0.9)*3.14)/180)));
  }

  delay(2000);

  myGLCD.setColor(0,0,0);
  myGLCD.fillRect(1,15,798,464);
  myGLCD.setColor(0, 0, 255);
  myGLCD.setBackColor(0, 0, 0);
  myGLCD.drawLine(399, 15, 399, 464);
  myGLCD.drawLine(1, 239, 798, 239);

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

  delay(2000);
  
  myGLCD.setColor(0,0,0);
  myGLCD.fillRect(1,15,798,464);

// Draw some random filled rectangles
  for (int i=0; i<50; i++)
  {
    myGLCD.setColor(random(255), random(255), random(255));
    x=2+random(746);
    y=16+random(397);
    x2=x+50;
    y2=y+50;
    myGLCD.fillRect(x, y, x2, y2);
  }

  delay(2000);
  
  myGLCD.setColor(0,0,0);
  myGLCD.fillRect(1,15,798,464);

// Draw some random filled, rounded rectangles
  for (int i=0; i<50; i++)
  {
    myGLCD.setColor(random(255), random(255), random(255));
    x=2+random(746);
    y=16+random(397);
    x2=x+50;
    y2=y+50;
    myGLCD.fillRoundRect(x, y, x2, y2);
  }
  
  delay(2000);
  
  myGLCD.setColor(0,0,0);
  myGLCD.fillRect(1,15,798,464);

// Draw some random filled circles
  for (int i=0; i<50; i++)
  {
    myGLCD.setColor(random(255), random(255), random(255));
    x=27+random(746);
    y=41+random(397);
    myGLCD.fillCircle(x, y, 25);
  }
  
  delay(2000);
  
  myGLCD.setColor(0,0,0);
  myGLCD.fillRect(1,15,798,464);

// Draw some lines in a pattern
  myGLCD.setColor (255,0,0);
  for (int i=15; i<463; i+=5)
  {
    myGLCD.drawLine(1, i, (i*1.66)-10, 463);
  }
  myGLCD.setColor (255,0,0);
  for (int i=463; i>15; i-=5)
  {
    myGLCD.drawLine(798, i, (i*1.66)+30, 15);
  }
  myGLCD.setColor (0,255,255);
  for (int i=463; i>15; i-=5)
  {
    myGLCD.drawLine(1, i, 770-(i*1.66), 15);
  }
  myGLCD.setColor (0,255,255);
  for (int i=15; i<463; i+=5)
  {
    myGLCD.drawLine(798, i, 810-(i*1.66), 463);
  }
  
  delay(2000);
  
  myGLCD.setColor(0,0,0);
  myGLCD.fillRect(1,15,798,464);

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

  delay(2000);
  
  myGLCD.setColor(0,0,0);
  myGLCD.fillRect(1,15,798,464);

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

  delay(2000);
  
  myGLCD.setColor(0,0,0);
  myGLCD.fillRect(1,15,798,464);

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

  delay(2000);
  
  myGLCD.setColor(0,0,0);
  myGLCD.fillRect(1,15,798,464);

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

  delay(2000);
  
  myGLCD.setColor(0,0,0);
  myGLCD.fillRect(1,15,798,464);

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

  delay(2000);

  myGLCD.fillScr(0, 0, 255);
  myGLCD.setColor(255, 0, 0);
  myGLCD.fillRoundRect(320, 190, 479, 289);
  
  myGLCD.setColor(255, 255, 255);
  myGLCD.setBackColor(255, 0, 0);
  myGLCD.print("www.buydisplay.com", CENTER, 195);
  myGLCD.print("That's it!", CENTER, 213);
  myGLCD.print("Restarting in a", CENTER, 239);
  myGLCD.print("few seconds...", CENTER, 252);
  
  myGLCD.setColor(0, 255, 0);
  myGLCD.setBackColor(0, 0, 255);
  myGLCD.print("Runtime: (msecs)", CENTER, 450);
  myGLCD.printNumI(millis(), CENTER, 465);
  
  delay (10000);
}


In deinem Sketch vermisse ich u.A. die Treiber für I2C und SPI.
Ob die beide aktuell benötigt werden, sollte im Datenblatt des Display stehen.

Schau mal hier rein...das dürfte der gleiche displaytyp sein. Vielleicht kriegst du ein paar anregungen https://forum.arduino.cc/t/projektvorstellung-womo-monitor/1162849

Moin @metroboomin374 ,

ich vermute, dass dies die Quelle der von Dir genutzten UTFT Library ist:

https://github.com/ivanseidel/UTFT/tree/master/examples

Dort findet man auch eine Dokumentation zur Library, z.B. den print-Befehl.

Danach find LEFT, CENTER, RIGHT für die x-Koordinate vorgesehen, jedoch nicht für die y-Koordinate. Was passiert, wenn Du

myGLCD.print("Anzeige Test", CENTER, CENTER);

durch

myGLCD.print("Anzeige Test", CENTER, 100);

ersetzt?

Ansonsten befinden sich unter dem o.a. Link - je nach Controllertyp (AVR oder ARM) - weitere Beispielprogramme. Falls das oben vorgeschlagene nicht erfolgreich ist, versuche mal das passende 800x480er-Beispiel zu kompilieren und hochzuladen.

Wenn das läuft, könntest Du darauf aufbauen. Der Code "vom Hersteller" von Post 8 ist durch den Einbau der Touch-Screen-Initialisierung und -behandlung ein wenig überladen.

Im setup() des Beispiels aus Post 8 findet man übrigens folgende Sequenz, aus der man wohl im Fehlerfall nicht mehr herauskommt:

  uint8_t bb[2];
  readGT9271TouchAddr(0x8047, bb, 2);
  while (bb[1] != 32)
  { Serial.println("Capacitive touch screen initialized failure");
    pinMode(GT9271_RESET, OUTPUT);
    pinMode     (GT9271_INT, OUTPUT);
    digitalWrite(GT9271_RESET, LOW);
    delay(20);
    digitalWrite(GT9271_INT, LOW);
    delay(50);
    digitalWrite(GT9271_RESET, HIGH);
    delay(100);
    pinMode     (GT9271_INT, INPUT);
    delay(100);


    uint8_t re = GT9271_Send_Cfg((uint8_t*)GTP_CFG_DATA, sizeof(GTP_CFG_DATA));

  }

Meines Erachtens fehlt in der while-Schleife ein Aufruf von

readGT9271TouchAddr(0x8047, bb, 2);

da sich der Wert von bb[1] ansonsten nie ändern kann ...

Viel Erfolg!
ec2021

Ich meine im Hinterkopf zu haben dass die original UTFT nicht dunktioniert bei diesen displays. Der Hersteller hat da aber eine angepasste mitgeliefert.

Dann ist es allerdings nicht unwahrscheinlich, dass die Funktionsaufrufe gleich geblieben sind.

Insofern wäre es interessant zu testen, was bei Anwendung der Anpassung des Print- Statements passiert...

hey ec2021,

Ich habe die myGLCD.print("Anzeige Test", Center, Center); durch deinen Vorschlag geändert jedoch ändert sich leider nichts, während dem Hochladen vom Sketch wird Anzeige Test angezeigt jedoch sobald der upload fertig ist erlischt es.

Ich habe ein Beispiel Sketch für mein Display hochgeladen jedoch kämpfe ich mit der Fehlermeldung ArduinoOutStream does not name a type, obwohl ich die SDFat.h Libary eingebunden habe.

Ich benutze einen Arduino Due R3 mit dem Shield TFT LCD/SD Touch Arduino Shield ER-AS-SSD1963 V2.0

Hier ist das Beispielprogramm:

// UTFT_SdRaw_800x480_Demo
// Copyright (C)2015 Graham Lawrence (GHLawrence2000). All Rights reserved.
// web: https://github.com/ghlawrence2000/UTFT_SdRaw
//
// This program is a demo of how to use the functions provided by UTFT_SdRaw.
//
// This program requires the UTFT, URTouch, UTFT_Buttons and SdFat libraries.
//
#include <SPI.h>
// SdFat lib from here :-
// https://github.com/greiman/SdFat/archive/master.zip
#include <SdFat.h>
#include <UTFT.h>
#include <URTouch.h>
#include <UTFT_Buttons.h>
#include <UTFT_SdRaw.h>
extern uint8_t SmallFont[];
extern uint8_t BigFont[];

#define SD_CHIP_SELECT  53  // SD chip select pin
// file system object
SdFat sd;
// print stream
ArduinoOutStream cout(Serial);

int wait = 2, pressed_button;

// Initialize display
// ------------------
// Set the pins to the correct ones for your development board
// -----------------------------------------------------------
// Standard Arduino Uno/2009 Shield            : <display model>,19,18,17,16
// Standard Arduino Mega/Due shield            : <display model>,38,39,40,41
// CTE TFT LCD/SD Shield for Arduino Due       : <display model>,25,26,27,28
// Teensy 3.x TFT Test Board                   : <display model>,23,22, 3, 4
// ElecHouse TFT LCD/SD Shield for Arduino Due : <display model>,22,23,31,33
//
// Remember to change the model parameter to suit your display module!

UTFT myGLCD(SSD1963_800480, 38, 39, 40, 41);
//UTFT myGLCD(CTE50, 25, 26, 27, 28);
//UTFT myGLCD(CTE70, 25, 26, 27, 28);


// Initialize touchscreen
// ----------------------
// Set the pins to the correct ones for your development board
// -----------------------------------------------------------
// Standard Arduino Uno/2009 Shield            : 15,10,14, 9, 8
// Standard Arduino Mega/Due shield            :  6, 5, 4, 3, 2
// CTE TFT LCD/SD Shield for Arduino Due       :  6, 5, 4, 3, 2
// CTE TFT LCD/SD Shield for Arduino Due (JP10):  6, 5,32, 3, 2
// Teensy 3.x TFT Test Board                   : 26,31,27,28,29
// ElecHouse TFT LCD/SD Shield for Arduino Due : 25,26,27,29,30
//
URTouch  myTouch( 6, 5, 32, 3, 2);
//URTouch  myTouch( 6, 5, 4, 3, 2);

UTFT_SdRaw myFiles(&myGLCD);
UTFT_Buttons  myButtons(&myGLCD, &myTouch);

void setup()
{
  // Open serial communications and wait for port to open:
  Serial.begin(115200);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for DUE & Leonardo only
  }
  Serial.println(F("Initialising SD card..."));
  bool mysd = 0;
  // see if the card is present and can be initialized:
  while (!mysd)
  {
    if (!sd.begin(SD_CHIP_SELECT, SPI_FULL_SPEED)) {
      Serial.println(F("Card failed, or not present"));
      Serial.println(F("Retrying...."));
    }
    else
    {
      mysd = 1;
      Serial.println(F("Card initialised."));
    }
  }
  Serial.println(F("Initialising LCD."));
  myGLCD.InitLCD();
  myGLCD.clrScr();
  myGLCD.setFont(SmallFont);
  myTouch.InitTouch();
  myTouch.setPrecision(PREC_MEDIUM);
  myButtons.setTextFont(BigFont);
  int butskip = myButtons.addButton( 85,  219 , 70,  20, "Skip");
  Serial.println(F("LCD initialised."));
  // ////////////////////////////////////////////////////////////////////////////////
  //             Wait for GPS screen  or skip button
  ///////////////////////////////////////////////////////////////////////////////////
  Serial.println(F("Initialising GPS."));
  long mytime = millis();
  myFiles.load(0, 0, 240, 240, "wait4gps.RAW", 1 , 1);
  long mytime1 = millis() - mytime;
  cout << F("Time to draw 240x240 raw ") << mytime1 << F(" ms") << endl;
  myButtons.drawButton(butskip);
  while (wait == 2) {
    pressed_button = myButtons.checkButtons();
    if (pressed_button == butskip)
    {
      cout << F("Skip button detected (No GPS :( )\n");
      wait = true;
    }
  }
  char fname440[] = "SO11/SO100100.RAW";
  myGLCD.clrScr();
  mytime = millis();
  myFiles.load(20, 20, 440, 440, fname440, 1);
  mytime1 = millis() - mytime;
  cout << F("Time to draw 440x440 raw (no extra buffer) (non inverted colour) ") << mytime1 << F(" ms") << endl;
  delay(5000);
  myGLCD.clrScr();
  mytime = millis();
  myFiles.load(20, 20, 440, 440, fname440, 32, 0);
  mytime1 = millis() - mytime;
  cout << F("Time to draw 440x440 raw (32*buffer) (non inverted colour) ") << mytime1 << F(" ms") << endl;
  delay(5000);
  mytime = millis();
  myFiles.load(20, 20, 440, 440, fname440, 32, 1);
  mytime1 = millis() - mytime;
  cout << F("Time to draw 440x440 raw (32*buffer) (inverted colour) ") << mytime1 << F(" ms") << endl;
  delay(5000);
  myGLCD.clrScr();
  mytime = millis();
  myFiles.pan(20, 20, 440, 440, 0, 0, 4040, 4040, "SK45/SK45.RAW", 1);
  mytime1 = millis() - mytime;
  cout << F("Time to draw 440x440 portion from 4040x4040 raw image (inverted colour) ") << mytime1 << F(" ms") << endl;
  delay(5000);
  myGLCD.clrScr();
  int xad, yad;
  int xd = 0, yd = 0;
  int tmpx = 0, tmpy = 0;
  mytime = millis();
  for (int z = 0; z < 209; z++)
  {
    tmpy = (z / 19);
    tmpx = z - (tmpy * 19);
    xd = tmpx * 42;
    yd = tmpy * 42;
    tmpy = (z / 22);
    tmpx = z - (tmpy * 22);
    yad = (tmpy * 69) + 10;
    xad = (tmpx * 108) + 44;
    myFiles.pan(xd, yd, 42, 42, xad, yad, 2374, 696, "icons.raw");
  }
  mytime1 = millis();
  cout << F("time to draw 210 42x42 icons (ms) ") << (mytime1 - mytime) << endl;
  delay(5000);
  cout << F("Thanks for watching!") << endl;
  myGLCD.clrScr();
  myGLCD.setFont(BigFont);
  myGLCD.setColor(VGA_GREEN);
  myGLCD.print("Thanks for watching!", CENTER, 231);
}

void loop()
{
}

Schade, es war einen Versuch wert ...

Auf die Schnelle:

Dies sollte cout auf der Arduino-Plattform ermöglichen:

#include <Streaming.h> // die Lib findest du selber ;-)
Print &cout = Serial; // cout Emulation für "Arme"

Quelle: https://forum.arduino.cc/t/erledigt-serial-println-wird-ubersprungen/1090259/15

Ansonsten kannst Du im Beispielprogramm aus Post 14 die Zeile mit dem ArduinoOutStream löschen und alle cout- Aufrufe auf Serial.println() umschreiben.

Statt

cout << F("Text\n");

also

Serial.println(F("Text");

Wo mehrere Parameter ausgegeben werden, kann man die einzelnen Strings bzw. Daten separat nacheinander per Serial.print() ausgeben, den jeweils letzten der Zeile mit Serial.println() für den Zeilenumbruch (anstatt des endl oder \n).
Gruß
ec2021

Beispiel:

// Die folgende Zeile
  cout << F("Time to draw 440x440 portion from 4040x4040 raw image (inverted colour) ") << mytime1 << F(" ms") << endl;
// lässt sich durch dies ersetzen:
  Serial.print(F("Time to draw 440x440 portion from 4040x4040 raw image (inverted colour) "));
  Serial.print(mytime1);
  Serial.println(F(" ms"));

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.