// include TFT and SPI libraries
#include <TFT.h>
#include <SPI.h>
// pin definition for Arduino UNO
#define cs 10
#define dc 7
#define rst 9
// create an instance of the library
TFT TFTscreen = TFT(cs, dc, rst);
void setup() {
//initialize the library
TFTscreen.begin();
// clear the screen with a black background
TFTscreen.background(0, 0, 0);
//set the text size
TFTscreen.setTextSize(2);
TFTscreen.invertDisplay(1);
Serial.begin(9600);
}
void loop() {
Serial.print(TFTscreen.height());
Serial.print("x");
Serial.println(TFTscreen.width());
//generate a random color
int redRandom = random(0, 255);
int greenRandom = random (0, 255);
int blueRandom = random (0, 255);
// set a random font color
TFTscreen.stroke(redRandom, greenRandom, blueRandom);
// print Hello, World! in the middle of the screen
TFTscreen.text("Hello, World!", 6, 57);
// wait 200 miliseconds until change to next color
delay(200);
}
Whole screen should be drawn over with black, but what actually happens is that arduino thinks that the screen is 128x160px instead of 320x240px. The part that arduino does nothing about is filled with noise. The display I'm using is Waveshare 10684 and my arduino is uno.
Yes, but as you said. This is not the valid chip the library was made for. And expanding the values just made left and top sides be halfway filled with black.
Just wonderful that waveshare has named the library for their TFT display LCD. You will need to be careful that you do not have any of the numerous libraries for actual LCD displays installed, LCD.h is going to be a very common header file name and the compiler is not particularly smart about using the correct one.