Problems using 1.77" TFT LCD Screen. Removed from Arduino?

Hello,
my name is Beppe and I have a problem with tft screens from 1.77 original Arduino (LCD robot). I take care of a laboratory at school and I have 7 screens like these. These screens didn’t give me any problems until last year. Now if I try to load a simple program the screen remains white. I tried putting an old IDE or installing old libraries but nothing. When I install the latest TFT libraries I saw that they are withdrawn in the examples. The latest ADAFRUIT ST7735 TFT libraries are also installed.
Thank you all for your cooperation.

#include <TFT.h>  // Arduino LCD library
#include <SPI.h>

// pin definition for the Uno
#define cs   10
#define dc   9
#define rst  8

// pin definition for the Leonardo
// #define cs   7
// #define dc   0
// #define rst  1

// create an instance of the library
TFT TFTscreen = TFT(cs, dc, rst);

// char array to print to the screen
char sensorPrintout[4];

void setup() {

  // Put this line at the beginning of every sketch that uses the GLCD:
  TFTscreen.begin();

  // clear the screen with a black background
  TFTscreen.background(0, 0, 0);

  // write the static text to the screen
  // set the font color to white
  TFTscreen.stroke(255, 255, 255);
  // set the font size
  TFTscreen.setTextSize(2);
  // write the text to the top left corner of the screen
  TFTscreen.text("Sensor Value :\n ", 0, 0);
  // ste the font size very large for the loop
  TFTscreen.setTextSize(5);
}

void loop() {

  // Read the value of the sensor on A0
  String sensorVal = String(analogRead(A0));

  // convert the reading to a char array
  sensorVal.toCharArray(sensorPrintout, 4);

  // set the font color
  TFTscreen.stroke(255, 255, 255);
  // print the sensor value
  TFTscreen.text(sensorPrintout, 0, 20);
  // wait for a moment
  delay(250);
  // erase the text you just wrote
  TFTscreen.stroke(0, 0, 0);
  TFTscreen.text(sensorPrintout, 0, 20);
}

The TFT.h library is deprecated.
Use the Adafruit_ST7735.h library instead.

Some of the methods are different. e.g. initR() instead of begin()

But once you move to regular Adafruit GFX methods life becomes easier.

The only method that you might regret losing is loadImage() but we can show you a regular function.

David.

Hi, thank you for your answer. I tried with this code with Arduino UNO board but nothing, the display is white. This code was written for Arduino Mega but use the same pin of UNO. Is it possible to use TFT 1.77 with Arduino Uno V3? Excuse me for my English, i’m Italian.

#include <Adafruit_GFX.h>    
#include <Adafruit_ST7735.h> 
#include <SPI.h>


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

#define TFT_SCLK 13   
#define TFT_MOSI 11   

//Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS,  TFT_DC, TFT_RST);
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST);

void setup(void) {
  tft.initR(INITR_BLACKTAB);  
  tft.fillScreen(ST7735_BLACK); 
 
  tft.setTextColor(ST7735_WHITE);
  tft.setTextSize(0);
  tft.setCursor(30,80);
  tft.println("Hello World!");  
  delay(1000);
  
}

void loop() {

  tft.fillScreen(ST7735_WHITE); 
  delay(1000);
  tft.setTextColor(ST7735_BLACK);
  tft.setTextSize(0);
  tft.setCursor(30,80);
  tft.println("Hey you! You got it!");  

  delay(500);
}

I ran your program on a regular ST7735 display.
It displayed your message.

Normally you say tft.setTextSize(1);
instead of tft.setTextSize(0);

It also works fine with the HW SPI constructor. Just faster.

I suggest that you check your wiring. Post a photo.

David.

Thank you, i solved the problem. It was only a problem of broken jumper and breadboard so i used an “old style” wire . i can use also tft library now!