ST7735 background problem

When I'm using the ST7735 display I've a problem with the background, I want a black background, here is my code:

#include <Adafruit_GFX.h>
#include <Adafruit_ST7735.h>
#include <SPI.h>
#include <Fonts/FreeSans9pt7b.h>

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

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

void setup() {
  tft.initR(INITR_BLACKTAB);  

  tft.fillScreen(ST77XX_BLACK); 
  tft.setFont(&FreeSans9pt7b);  
  tft.setTextColor(ST77XX_WHITE);  
  tft.setCursor(10, 30); 
  tft.print("SALUT!");  
}

void loop() { 
}

and here is the result

I hope someone can help me :sleepy:

#change this
tft.fillScreen(ST77XX_BLACK);
#to this
tft.fillScreen(ST7735_BLACK);

#and this
  tft.setTextColor(ST77XX_WHITE);  
#to this
  tft.setTextColor(ST7735_WHITE);

Thanks for the answer, I've tried but I got the same result.

This is from ST7735.h. Are you certain your display has a black tab?

// Differences between displays (usu. identified by colored tab on
// plastic overlay) are odd enough that we need to do this 'by hand':
void initB(void); // for ST7735B displays
void initR(uint8_t options = INITR_GREENTAB); // for ST7735R

Honestly, I can't really see how to initialise the screen, it's the ST7735 1.77 inch from AZ-Delivery, but using the code from their documentation I'm having the same problem. here is their code

#include <Adafruit_GFX.h> // Core graphics library
#include <Fonts/FreeSansBold9pt7b.h>
#include <Adafruit_ST7735.h> // Hardware-specific library
#include <SPI.h>
Adafruit_ST7735 tft = Adafruit_ST7735(10, 8, 9);
void setup(void) {
 tft.initR(INITR_GREENTAB);
 tft.fillScreen(ST77XX_BLACK);
 delay(500);
 show_page();
 tft.setTextColor(ST77XX_WHITE, ST77XX_BLACK);
 tft.setTextSize(2);
 tft.setFont(); // reset font to default
}
void loop() {
 for(uint8_t i = 0; i < 100; i++) {
 changing_value(i);
 // delay(100);
 }
}
void show_page() {
 tft.setFont(&FreeSansBold9pt7b);
 tft.fillScreen(ST77XX_BLACK);
 tft.setTextColor(ST77XX_RED);
 tft.setCursor(14, 22);
 tft.print("AZ-Delivery");
 tft.drawFastHLine(0, 35, 128, ST77XX_GREEN);
 tft.drawTriangle(1, 45, 28, 70, 55, 45, ST77XX_WHITE);
 tft.fillTriangle(78, 70, 104, 45, 127, 70, 0xA3F6);
 tft.drawRect(1, 80, 50, 30, ST77XX_BLUE);
 tft.fillRoundRect(78, 80, 50, 30, 5, 0x2D4E);
 tft.fillCircle(25, 135, 15, 0x5BA9);
 tft.drawCircle(102, 135, 15, ST77XX_GREEN);
 tft.drawLine(45, 150, 80, 40, ST77XX_ORANGE);
}
void changing_value(uint8_t value) {
 if(value < 10) {
 tft.setCursor(15, 88);
 tft.print("0");
 tft.print(value);
 }
 else {
 tft.setCursor(15, 88);
 tft.print(value);
 }
}

I don't know either, but here are the options. If the demo code uses GREENTAB, then I would stick to that.

// some flags for initR() :(
#define INITR_GREENTAB 0x00
#define INITR_REDTAB 0x01
#define INITR_BLACKTAB 0x02
#define INITR_18GREENTAB INITR_GREENTAB
#define INITR_18REDTAB INITR_REDTAB
#define INITR_18BLACKTAB INITR_BLACKTAB
#define INITR_144GREENTAB 0x01
#define INITR_MINI160x80 0x04
#define INITR_HALLOWING 0x05
#define INITR_MINI160x80_PLUGIN 0x06

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.