Components Required

Image Component Quantity Available in Kit
evive 1
USB A-B Cable 1

TFT Colour

In the last tutorial, you have seen how to write text on screen with white color. Well, what if you want to write with some other color?

You can set the text color using this function:

tft.setTextColor(color);

where color can be any of these define colors:

  1. ST7735_BLACK
  2. ST7735_BLUE
  3. ST7735_RED
  4. ST7735_GREEN
  5. ST7735_CYAN
  6. ST7735_MAGENTA
  7. ST7735_YELLOW
  8. ST7735_WHITE

These colors are not only available for this function only, there are other function also which can have these colors in their argument.

Given below is an example to show the use of different colors and the response of the TFT Screen:

But what if I want to have a random colour?

Well, there also a function to generate a custom colour:

tft.Color565(uint8_t r, uint8_t g, uint8_t b);

where r, g, b are the red, green and blue value ranging from 0 to 255.

TFT Text Size

You can also vary text size using function:

tft.setTextSize(unit8_t size);

Given below is the Arduino sketch to show you different text size.