How to Manipulate Text on TFT Display

About This Tutorial
This tutorial discusses how to change the colour and size of text on evive's TFT Display using functions from the TFT library in Arduino IDE.
Tutorial Info
Programming Platform:
Difficulty:
Estimated Time (hrs):
2

Components Required

ImageComponentQuantityAvailable in Kit
evive1
USB A-B Cable1

Introduction

This tutorial discusses a few more functions regarding the colour and size of text on evive’s TFT Display using functions from the TFT library in Arduino IDE, apart from the functions discussed in the tutorial on Getting Started with TFT Display.

TFT Colour

You can change the colour of the text using the following function:

tft.setTextColor(color);

where color can be any of these predefined 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

Apart from this function, other functions can also have these colours in their argument.

Below is an example showing how to change the color of the text on the screen:

 

Instead of setting colours manually, it is possible to put the responsibility of selecting any random colour on the shoulders of Arduino IDE. It can be done with the help of the function given below:

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 vary the size of the text using the function shown below:

tft.setTextSize(unit8_t size);

Below is the Arduino sketch showing the use of function for changing the size of the text:

 

 

This Helped
This didn't help
Share this Tutorial
Facebook
Twitter
Google+
Pinterest
Reddit
Print
Related Tutorials
Featured Projects

Leave a Reply

Close Menu
×

Cart