blink when using font

i want to measure my toys battery

but my lcd was blinking every half second when i using font and looks ok when not using font
whats wrong with my code?

#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SPFD54124B.h>
#include <Fonts/FreeSerif9pt7b.h>

#define TFT_CS        10
#define TFT_RESET     12
#define BLACK           0x0000
#define BLUE            0x001F
#define RED             0xF800
#define GREEN           0x07E0
#define CYAN            0x07FF
#define MAGENTA         0xF81F
#define YELLOW          0xFFE0
#define WHITE           0xFFFF

int analogInput = A0;
float vout = 0.0;
float vin = 0.0;
float R1 = 10000.0;
float R2 = 1000.0;
int value = 0;

Adafruit_SPFD54124B display(TFT_RESET, TFT_CS); 

void setup(void) {
Serial.begin(9600);
display.begin();
display.setRotation(1);
display.fillScreen(BLACK);
//display.fillRect(1,0,100,50, BLACK);

//delay(1) ;
}

void loop() {
  value = analogRead(analogInput);
  vout = (value * 5.0) / 1024.0;
  vin = vout / (R2/(R1+R2));
  if (vin<0.09) {
  vin=0.0;}

  display.setTextColor(CYAN, BLACK);
  display.fillRect(1,0,161,128, BLACK);
  //display.fillRect(1,0,100,50, CYAN);
  display.setFont(&FreeSerif9pt7b);  
  display.setTextSize(3);
  display.setCursor(10, 60);
  display.print(vin);
  //display.fillScreen(BLACK); 
  }

Is it necessary to do setTextColor, setFont, setTextSize everytime ? If not, just do it once.

Can you give us a better description than, "blinking"?

aarg:
Can you give us a better description than, "blinking"?

show character and no character every one second

guix:
Is it necessary to do setTextColor, setFont, setTextSize everytime ? If not, just do it once.

if the way I can affect the display that makes it blink, then how is the right way?

For example move in setup()

#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SPFD54124B.h>
#include <Fonts/FreeSerif9pt7b.h>

#define TFT_CS        10
#define TFT_RESET     12
#define BLACK           0x0000
#define BLUE            0x001F
#define RED             0xF800
#define GREEN           0x07E0
#define CYAN            0x07FF
#define MAGENTA         0xF81F
#define YELLOW          0xFFE0
#define WHITE           0xFFFF

int analogInput = A0;
float vout = 0.0;
float vin = 0.0;
float R1 = 10000.0;
float R2 = 1000.0;
int value = 0;

Adafruit_SPFD54124B display(TFT_RESET, TFT_CS);

void setup(void) {
Serial.begin(9600);
display.begin();
display.setRotation(1);
display.setTextColor(CYAN, BLACK);
display.setFont(&FreeSerif9pt7b); 
display.setTextSize(3);
display.fillScreen(BLACK);
//display.fillRect(1,0,100,50, BLACK);

//delay(1) ;
}

void loop() {
  value = analogRead(analogInput);
  vout = (value * 5.0) / 1024.0;
  vin = vout / (R2/(R1+R2));
  if (vin<0.09) {
  vin=0.0;}

  display.fillRect(1,0,161,128, BLACK);
  //display.fillRect(1,0,100,50, CYAN);
  display.setCursor(10, 60);
  display.print(vin);
  //display.fillScreen(BLACK);
  }

And also you could only update the display when necessary, for example only once per second, or only when vin changed.

static float vin_previousValue = vin;
if ( vin_previousValue != vin )
{
  vin_previousValue = vin;
  display.fillRect(1,0,161,128, BLACK);
  //display.fillRect(1,0,100,50, CYAN);
  display.setCursor(10, 60);
  display.print(vin);
  //display.fillScreen(BLACK);
}

there is still no change sir

Show your code.

my first code

#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SPFD54124B.h>
#include <Fonts/FreeSerif9pt7b.h>

#define TFT_CS        10
#define TFT_RESET     12
#define BLACK           0x0000
#define BLUE            0x001F
#define RED             0xF800
#define GREEN           0x07E0
#define CYAN            0x07FF
#define MAGENTA         0xF81F
#define YELLOW          0xFFE0
#define WHITE           0xFFFF

int analogInput = A0;
float vout = 0.0;
float vin = 0.0;
float R1 = 10000.0;
float R2 = 1000.0;
int value = 0;

Adafruit_SPFD54124B display(TFT_RESET, TFT_CS);

void setup(void) {
Serial.begin(9600);
display.begin();
display.setRotation(1);
display.fillScreen(BLACK);
//display.fillRect(1,0,100,50, BLACK);

//delay(1) ;
}

void loop() {
  value = analogRead(analogInput);
  vout = (value * 5.0) / 1024.0;
  vin = vout / (R2/(R1+R2));
  if (vin<0.09) {
  vin=0.0;}

  display.setTextColor(CYAN, BLACK);
  display.fillRect(1,0,161,128, BLACK);
  //display.fillRect(1,0,100,50, CYAN);
  display.setFont(&FreeSerif9pt7b); 
  display.setTextSize(3);
  display.setCursor(10, 60);
  display.print(vin);
  //display.fillScreen(BLACK);

edited

#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SPFD54124B.h>
#include <Fonts/FreeSerif9pt7b.h>

#define TFT_CS        10
#define TFT_RESET     12
#define BLACK           0x0000
#define BLUE            0x001F
#define RED             0xF800
#define GREEN           0x07E0
#define CYAN            0x07FF
#define MAGENTA         0xF81F
#define YELLOW          0xFFE0
#define WHITE           0xFFFF

int analogInput = A0;
float vout = 0.0;
float vin = 0.0;
float R1 = 10000.0;
float R2 = 1000.0;
int value = 0;

Adafruit_SPFD54124B display(TFT_RESET, TFT_CS);

void setup(void) {
Serial.begin(9600);
display.begin();
display.setRotation(1);
display.setTextColor(CYAN, BLACK);
display.setFont(&FreeSerif9pt7b);
display.setTextSize(3);
 display.fillScreen(BLACK);

//display.fillRect(1,0,161,128, BLACK);
//delay(1) ;

}

void loop() {
  value = analogRead(analogInput);
  vout = (value * 5.0) / 1024.0;
  vin = vout / (R2/(R1+R2));
  if (vin<0.09) {
  vin=0.0;}

 static float vin_previousValue = vin;

if ( vin_previousValue != vin )
{
  vin_previousValue = vin;
  display.fillRect(1,0,161,128, BLACK);
  //display.fillRect(1,0,100,50, CYAN);
  display.setCursor(10, 60);
  display.println(vin);
  //display.fillScreen(BLACK);
  
}
  }