3.5" TFT (PRODUCT ID: 2050) / Text is blinking

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
NoClue2mGlue
 
Posts: 5
Joined: Fri Oct 24, 2014 5:37 pm

3.5" TFT (PRODUCT ID: 2050) / Text is blinking

Post by NoClue2mGlue »

Dear adafruit-team,
today I got my 3.5" TFT. I connected it like it is descriped in your tutorial via SPI. I tried the example sketch "graphicstest"...it worked fine!
After that I tried my own little code. Just getting some text on the tft.
But the text is blinking all the time. I am a beginner that´s why - I guess - it will be just a mistakes made through my own lack of knowledge,
I would be very happy if someone could tell me what I have to do in my code below for getting a permanent text on the tft (without blinking).

Code: Select all

#include <SPI.h>
#include "Adafruit_GFX.h"
#include "Adafruit_HX8357.h"

#define TFT_CS 10
#define TFT_DC 9
#define TFT_RST 8

Adafruit_HX8357 tft = Adafruit_HX8357(TFT_CS, TFT_DC, TFT_RST);

void setup() {
  Serial.begin(9600);
  Serial.println("HX8357D Test!"); 
  tft.begin(HX8357D);
  }

void loop(void) {  
    testText();
    delay(10000); // LOWER BLINKING FREQUENCY OF TEXT ON TFT
    //delay(1); // HIGHER BLINKING FREQUENCY OF TEXT ON TFT
  }
  
char testText() {
  tft.fillScreen(HX8357_BLACK);
  tft.setCursor(100, 100);
  tft.setTextColor(HX8357_WHITE);  tft.setTextSize(3);
  tft.println("BLINK!!");
}
Thank you very much!
Best wishes,
Fabian

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: 3.5" TFT (PRODUCT ID: 2050) / Text is blinking

Post by adafruit_support_mike »

The text is blinking because you call tft.fillScreen() before calling tft.println().

It takes a certain amount of time to fil the screen, so the lag between "covering the old text during the fill" and "drawing the new text" makes the text blink.

You can speed things up by drawing a rectangle just big enough to cover the text.

User avatar
NoClue2mGlue
 
Posts: 5
Joined: Fri Oct 24, 2014 5:37 pm

Re: 3.5" TFT (PRODUCT ID: 2050) / Text is blinking

Post by NoClue2mGlue »

Hi Mike,
thanks a lot! I tried your proposal and it works fine now.

Have a nice weekend!

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”