Adafruit ST7735

Bonjour,
j'ai modifié un code pour obtenir ca :

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

#define SD_CS    4  // Chip select line for SD card
#define TFT_CS  10  // Chip select line for TFT display
#define TFT_DC   8  // Data/command line for TFT
#define TFT_RST  -1  // Reset line for TFT (or connect to +5V)

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

#define BUTTON_NONE 0
#define BUTTON_DOWN 1
#define BUTTON_RIGHT 2
#define BUTTON_SELECT 3
#define BUTTON_UP 4
#define BUTTON_LEFT 5
#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 C=2;
void setup(void) {
  Serial.begin(9600);

  tft.initR(INITR_REDTAB);   // initialize a ST7735R chip, red tab
  // If your TFT's plastic wrap has a Green Tab, use the following:
  //tft.initR(INITR_GREENTAB); // initialize a ST7735R chip, green tab

  Serial.println("OK!");
  tft.fillScreen(0x0000);
}


uint8_t readButton(void) {
  float a = analogRead(3);
  
  a *= 5.0;
  a /= 1024.0;
  
  Serial.print("Button read analog = ");
  Serial.println(a);
  if (a < 0.2) return BUTTON_DOWN;
  if (a < 1.0) return BUTTON_RIGHT;
  if (a < 1.5) return BUTTON_SELECT;
  if (a < 2.0) return BUTTON_UP;
  if (a < 3.2) return BUTTON_LEFT;
  else return BUTTON_NONE;
  }

uint8_t buttonhistory = 0;

void loop() {
  uint8_t b = readButton();
  tft.setTextSize(3);
  if (b == BUTTON_DOWN)
  {
    tft.setTextColor(ST7735_RED);
    tft.setCursor(0, 10);
    tft.print("T Int = C");
    buttonhistory |= 1;
  }

  if (b == BUTTON_LEFT) {
    tft.setTextColor(ST7735_YELLOW);
    tft.setCursor(0, 60);
     tft.print("T Ext = C");
    buttonhistory |= 2;
   }
  if (b == BUTTON_UP) {
    tft.setTextColor(ST7735_GREEN);
    tft.setCursor(0, 110);
    tft.print("Niv Eau = D"); 
    buttonhistory |= 4;
  }
  delay(100);

J'aimerai qu'a chaque mouvement du joystick, l'écran s'efface pour mettre le texte suivant

J'ai essayer de rajouter un tft.print ("    "); mais ca ne marche pas

Une aide ?

Merci d'avance

Essaye tft.fillScreen(BLACK)

Je test sa demain, merci de l'info ! :slight_smile:

Hello
I bought from China 1.8” SPI LCD Module and would like to run it on Arduino Due Board.
I have IDE software version 1.5.5 . I need for Due libraries files: St7735.h, GFX.h, SPI.h, SD.h.
My Display work only with 3.3V ( not 5V) :smiley: