evive has a TFT display for visual feedback. Visual feedback is very useful for electronics projects and prototyping. It helps you with
- debugging your code
- displaying data
- asking for user feedback
- giving an aesthetic appearance to your project
evive has a 1.8″ TFT Display with 128 x 160 color pixel. This TFT uses ST7735R TFT driver to display 18-bit color (262,144 shades).
The TFT is already integrated in the evive library.
How to write text on TFT
Follow the steps below to write ‘Hello World’ on the TFT screen:
- Connect evive to your laptop/PC, and select the appropriate port.
- Add evive library in your Arduino IDE; it has a lot of functions for TFT display. To initialise the TFT, you must add the function tft_init(INITR_BLACKTAB); in the beginning of the program. This function initialises the TFT screen with a black background.
- To write on TFT, you must first set the cursor at the point where you want to write. For this, write the statement tft.setCursor (x,y); , where x and y are the coordinates on the screen. The top left corner on the TFT Screen is (1, 1). When you move to right on the screen, x increases, and when you move down, y value increases.
- To display the text use either tft.print(“Hello World!”); or tft.println(“Hello World”); .
tft.print(): When this function is used to write text, the cursor remains in the same line. If you use this function the second time to write something new, it displays it immediately next to the previously written text. E,g, if you write tft.print(“Hi”); two times, the output on the screen will be HiHi.
tft.println(): This function adds a new line after the text is displayed on the screen. If you use this function to write something new, it will display the net in the new line. E.g. if you write tft.println(“Hi”); twice, the output on the screen will be
|setCursor(int16_t x, int16_t y)||Set cursor to a location|
|print(string)||Display input string on TFT|
|println(string)||Display input string on TFT and move to next line|
|tft_init();||initialize TFT display
Pass "INITR_BLACKTAB" in agrument while using this function i.e like tft_init(INITR_BLACKTAB) in order to initialize tft with background.
|tft.fillScreen(ST7735_BLACK);||this fills display with black colour|
|tft.setTextColor();||this function sets color of text to color passed as argument in this function. For example tft.setTextColor(ST7735_WHITE) sets text color to white.|