Pemíteme aislar cada uno de los datos que se van a imprimir en pantalla:
tft.setTextSize(5);
dato1 = Serial1.parseInt();
sprintf(TX,"%3d C",dato1); //aquí ya le das un formato a tus datos y se almacena en la variable temporal TX
tft.setCursor(137,20);
tft.setTextColor(YELLOW,BLACK); //En una sola instrucción le das todos los colores a tu presentación: el primero es el color de la fuente y el segundo es el color del fondo de la fuente
tft.println(TX);
dato2 = Serial1.parseInt();
sprintf(TX,"%3d C",dato2); //aquí ya le das un formato a tus datos y se almacena en la variable temporal TX
tft.setCursor(137,65);
tft.setTextColor(RED,BLACK); //En una sola instrucción le das todos los colores a tu presentación: el primero es el color de la fuente y el segundo es el color del fondo de la fuente
tft.println(TX);
dato3 = Serial1.parseInt();
sprintf(TX,"%3d C",dato3); //aquí ya le das un formato a tus datos y se almacena en la variable temporal TX
tft.setCursor(137,110);
tft.setTextColor(GREEN,BLACK); //En una sola instrucción le das todos los colores a tu presentación: el primero es el color de la fuente y el segundo es el color del fondo de la fuente
tft.println(TX);
De esa forma ya no tendrías problemas en visualizar correctamente los datos, recuerda que TX es solo temporal y la llamas cada vez que necesites mostrar un dato en pantalla.
Te dejo un ejemplo con tres variables como las que pretendes imprimir, solo que son generadas como números aleatorios
#include <Adafruit_GFX.h>
#include <Adafruit_TFTLCD.h>
#define LCD_CS A3
#define LCD_CD A2
#define LCD_WR A1
#define LCD_RD A0
#define LCD_RESET A4
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);
char TX[50];
void setup() {
Serial.begin(9600);
#ifdef USE_ADAFRUIT_SHIELD_PINOUT
Serial.println(F("Using Adafruit 2.8\" TFT Arduino Shield Pinout"));
#else
Serial.println(F("Using Adafruit 2.8\" TFT Breakout Board Pinout"));
#endif
Serial.print("TFT size is "); Serial.print(tft.width()); Serial.print("x"); Serial.println(tft.height());
tft.reset();
uint16_t identifier = tft.readID();
if(identifier == 0x9325) {
Serial.println(F("Found ILI9325 LCD driver"));
} else if(identifier == 0x9328) {
Serial.println(F("Found ILI9328 LCD driver"));
} else if(identifier == 0x7575) {
Serial.println(F("Found HX8347G LCD driver"));
} else if(identifier == 0x9341) {
Serial.println(F("Found ILI9341 LCD driver"));
} else if(identifier == 0x8357) {
Serial.println(F("Found HX8357D LCD driver"));
} else {
Serial.print(F("Unknown LCD driver chip: "));
Serial.println(identifier, HEX);
Serial.println(F("If using the Adafruit 2.8\" TFT Arduino shield, the line:"));
Serial.println(F(" #define USE_ADAFRUIT_SHIELD_PINOUT"));
Serial.println(F("should appear in the library header (Adafruit_TFT.h)."));
Serial.println(F("If using the breakout board, it should NOT be #defined!"));
Serial.println(F("Also if using the breakout, double-check that all wiring"));
Serial.println(F("matches the tutorial."));
return;
}
tft.begin(identifier);
tft.setRotation(3);
tft.fillScreen(BLACK);
tft.setCursor(0, 0);
tft.setTextColor(WHITE, BLACK); tft.setTextSize(4);
tft.println("Hello World!");
Serial.println(F("Done!"));
Temp3datos();
}
void Temp3datos()
{
tft.setTextSize(5);
do
{
int dato1 = random(0,150);
sprintf(TX,"%3d C", dato1);
tft.setCursor(137, 45);
tft.setTextColor(YELLOW, BLACK); tft.setTextSize(3);
tft.println(TX);
int dato2 = random(75,120);
sprintf(TX,"%3d C", dato2);
tft.setCursor(137, 85);
tft.setTextColor(RED, BLACK); tft.setTextSize(3);
tft.println(TX);
int dato3 = random(75,120);
sprintf(TX,"%3d C", dato3);
tft.setCursor(137, 125);
tft.setTextColor(GREEN, BLACK); tft.setTextSize(3);
tft.println(TX);
delay(500);
}
while(1);
}
void loop(){} //No todo se puede meter en el loop