Incompatibility TM1637 displays, tft Adafruit ST7789 or dht11 and problems with 74HC595


I have a project where right now I use several TM1637 displays and one dht11, everything works ok until I have to add the code for the Adafruit ST7789 tft screen that asks me to put SPI_MODE2 when initializing it and leaves the displays without refreshing.

On the other hand, the ST7789 itself has a strange behavior, painting the screen in blue for a few seconds (as I indicated) and then returning to a lemon yellow.

My other problem is that, although the code seems to send the string correctly to the 74HC595 display (7 segments, 8 bits) it does not show the data correctly. I wanted to confirm if it is a problem in the code or the display is wrong.

Here is my current code:

#include <ShiftDisplay2.h>
#include <LedControl.h>
#include <TM1637Display.h>
#include <Adafruit_ST7789.h>
#include <SPI.h>
#include <Adafruit_GFX.h> 
#include <DHT.h>
#include <DHT_U.h>
#include <arduino.h>
#include <ezTime.h>

//Declaramos el sensor de humedad
#define DHTPIN 12
#define DHTType DHT11

//Declaramos los displays de temperatura y humedad

#define CLK  2
#define DIO  3
#define CLK2 4
#define DIO2 5
#define CLK3 6
#define DIO3 7

//Definimos el delay general

#define demora 2000

//Declaramos las variables para la fecha

int diau,diad,mesu,mesd,anou,anod,aux = 0;

//Definimos el panel de fecha

ShiftDisplay2 display(A3, A4, 9, COMMON_CATHODE, 8);
String fecha = "04-12-88";
String inicio = "12345678";

//LedControl fecha=LedControl(9,A3,A4,1);

// Definimos la temperatura
LedControl temperatura=LedControl(A0,A1,A2,1);

//Definimos los paneles de hora, temperatura y humedad

TM1637Display hora(CLK, DIO);
TM1637Display hume(CLK2, DIO2);
TM1637Display temp(CLK3, DIO3);

//Definimos el sensor de humedad

DHT dht11(DHTPIN, DHTType);

//Definimos la pantalla TFT

#define TFT_CS     11
#define TFT_RST    8 
#define TFT_DC     10 

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

//Declaramos las variables para temperatura y humedad

int previoMillis;

//Declaramos una matriz para limpiar los segmentos de los paneles

uint8_t data[] = { 0x0, 0x0, 0x0, 0x0 };  // all segments clear    

//Declaramos el intervalo para el corredor

long interval = 1000;

//Matriz para pintar simbolo de humedad

uint8_t humedad[] = {
  SEG_G,  // Circle
  SEG_B | SEG_C | SEG_E | SEG_F |SEG_G,};   // H

//Matriz para pintar simbolo de grados

uint8_t grados[] = {
  SEG_A | SEG_B | SEG_F | SEG_G,  // Circle
  SEG_A | SEG_D | SEG_E | SEG_F };  // C 

void setup() {

  // Inicializamos el puerto com para debug

  //Inizializamos el sensor de humedad

  //Inicializamos los paneles


  display.set(inicio, ALIGN_LEFT);;

  temperatura.shutdown(0, false);
   //Definimos la fecha de inicio

  setTime (9,11,12,10,12,2021);

  // Iniciamos pantalla tft

  tft.init(240, 240, SPI_MODE2);


void loop() {


unsigned long correMillis = millis();

//Bucle corredor

if ((correMillis - previoMillis) >= interval)
    previoMillis = correMillis;
    RELATIVA = dht11.readHumidity();
    RELATIVA1 = dht11.readTemperature();
  //Mostramos humedad
  temp.showNumberDec(RELATIVA, true, 2, 0);
  temp.setSegments(humedad, 2, 2);

  //Mostramos hora
  time_t t = now();
  hora.showNumberDecEx (hour(t), 0b1000000, true,2,0);
  hora.showNumberDec (minute(t), true, 2, 2);

  //Mostramos temperatura
  hume.showNumberDec(RELATIVA1, true, 2, 0);
  hume.setSegments(grados, 2, 2);
  for(int fila = 0; fila < 8; fila++){
    for(int columna = 0; columna<8; columna ++){
      temperatura.setLed(0,fila,columna, true);

//Llamamos a la funcion para la fecha



void mostrardia(){

  fecha = dateTime("d-m-y");
  display.set(fecha, ALIGN_LEFT);;


what for is the 74HC595?

I use it to show the current date, it has been the only white display that I have been able to find with 8 bits.

but you have to call display.update() at least every 10 milliseconds to refresh all digits

Which type arduino are you using? On an UNO / Nano, pins 11, 12, and 13 are needed for the SPI interface to the display. You cannot have the DHT on pin 12 and TFT_CS on pin 11.