I connected my new LCD according to the following instructions:
The only thing I did different is to connect the backlight pin 8 on the LCD to PWM pin 3 on the Uno, of course with a voltage divider to step it down to about 3.3v, for regulating the backlight in the future. For now I hardcoded max brightness.
The result is as above: there are streaks on the media buttons and the black background I placed the white "Hello World!" text on looks pretty grey.
At first I thought it's a defective LCD so I exchanged that but unfortunately the new LCD does exactly the same.
I tried changing the
tft.initR(INITR_BLACKTAB);
line to other tabs but it just worsened it. I also tried adding 1k resistors to the data lines one by one and nothing changed except when I did the RES pin, after which the image was at first a lot clearer but it flickers and then goes to stripes much like the first picture above.
What else can I try?
Below is my code:
#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
#define LCD_BL 3
//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.setRotation(1);
pinMode(LCD_BL, OUTPUT);
analogWrite(LCD_BL, 255);
}
void loop() {
helloworld();
delay(500);
mediabuttons();
delay(500);
}
void helloworld() {
tft.fillScreen(ST7735_BLACK);
tft.setTextColor(ST7735_WHITE);
tft.setTextSize(0);
tft.setCursor(30,80);
tft.println("Hello World!");
}
void mediabuttons() {
// play
tft.fillScreen(ST7735_BLACK);
tft.fillRoundRect(25, 10, 78, 60, 8, ST7735_WHITE);
tft.fillTriangle(42, 20, 42, 60, 90, 40, ST7735_RED);
delay(500);
// pause
tft.fillRoundRect(25, 90, 78, 60, 8, ST7735_WHITE);
tft.fillRoundRect(39, 98, 20, 45, 5, ST7735_GREEN);
tft.fillRoundRect(69, 98, 20, 45, 5, ST7735_GREEN);
delay(500);
// play color
tft.fillTriangle(42, 20, 42, 60, 90, 40, ST7735_BLUE);
delay(50);
// pause color
tft.fillRoundRect(39, 98, 20, 45, 5, ST7735_RED);
tft.fillRoundRect(69, 98, 20, 45, 5, ST7735_RED);
// play color
tft.fillTriangle(42, 20, 42, 60, 90, 40, ST7735_GREEN);
}