evive TFT Display

evive TFT Display

evive TFT Display

June 2, 2017

Introduction

evive has a 1.8” TFT Display which is mainly used for visual feedback. The display has a 128 x 160 colour pixels. The TFT driver (ST7735R) can display full 18-bit colour (262,144 shades).

evive TFT Display

ST7735R Driver

The ST7735 is a single-chip controller/driver for 262K-color, graphic type TFT-LCD. It consists of 396 source line and 162 gate line driving circuits. This chip is capable of connecting directly to an external microprocessor and accepts Serial Peripheral Interface (SPI), 8-bit/9-bit/16-bit/18-bit parallel interface. Display data can be stored in the on-chip display data RAM of 132 x 162 x 18 bits. It can perform display data RAM read/write operation with no external operation clock to minimize power consumption.

Controlling display using Arduino IDE

We will use evive Library to control the TFT display in Arduino IDE. You can download it from here. If you don't know how to install a library, click here to see the tutorial.

 

Display Functions

Following are the functions available for use:


FunctionDescription
drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color)Draw a line using two points
drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color)Draw a vertical line
drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color)Draw a horizontal line
drawRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
Draw a rectangle using one point coordinate, width and height
fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)Draw a filled rectangle using one point coordinate, width and height
fillScreen(uint16_t color)Change screen colour
drawCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color)Draw a circle using center point coordinate and radius of the circle
fillCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color)Draw a filled circle using center point coordinate and radius of the circle
drawTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color)Draw a triangle using three points coordinate
fillTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color)Draw a filled triangle using three points coordinate
drawRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color)Draw a round rectangle using one point coordinate, width, height and radius
fillRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color)Draw a filled round rectangle using one point coordinate, width, height and radius
drawBitmap(int16_t x, int16_t y, const uint8_t *bitmap, int16_t w, int16_t h, uint16_t color)Draw a Bitmap
drawBitmap(int16_t x, int16_t y, const uint8_t *bitmap, int16_t w, int16_t h, uint16_t color, uint16_t bg)Draw a Bitmap
setCursor(int16_t x, int16_t y)Set cursor to a location
setTextColor(uint16_t c)Set text colour
setTextColor(uint16_t c, uint16_t bg)Set text colour
setTextSize(uint8_t s)Set text size
setTextWrap(boolean w)Set text wrap
setRotation(uint8_t r)Set rotation
int16_t height(void) const;Get height
int16_t width(void) const;Get width
uint8_t getRotation(void) const;Get Rotation
int16_t getCursorX(void) const;Get curser X position
int16_t getCursorY(void) const;Get curser Y position
println(text)Write text

Example

evive Alert
Alert: Please not that if your evive is not displaying the right color (RED) for this example code, change the arguement in the function, tft.init(INITR_BLACKTAB); to INTR_GREENTAB. Always remember which argument to use while initializing INITR_BLACKTAB or INITR_GREENTAB.

Controlling Display using Scratch

Using the evive TFT Display Extension blocks you can control the TFT display of evive.

Block NameRepresentation in ScratchFunction
evive ProgramThis block converts the script wearing it into Arduino code so that it can be uploaded to evive.
run evive Menu (Upload Firmware)This block is for uploading the Firmware when using the blocks under evive TFT display extension in Arduino mode for the first time.
work on Scratch Mode (Upload Firmware)This block is for uploading the Firmware when using the blocks under evive TFT display extension in Scratch mode for the first time.
FIll screen with colour ()This block fills the entire screen with the colour selected from the drop-down menu.
Set cursor at ()()This block sets the cursor position as the coordinates specified.
Set text colour () with background ()This blocks set the colour of the text along with that of the background, i.e. the screen to the colours specified in the drop-down menu.
Set text size as ()This block sets the size of the text according to the number specified.
Write ()This block is used to write text on the screen.
Draw line from ()() to ()() colour ()This block draws line a joining the two sets of coordinates specified and sets its colour to the colour selected from the drop-down menu.
Draw vertical line from ()() length () colour ()This block draws a vertical line of the given length from the coordinate specified and sets its colour to the colour selected from the drop-down menu.
Draw horizontal line from ()() length () colour ()This block draws a horizontal line of the given length from the coordinate specified and sets its colour to the colour selected from the drop-down menu.
Fill rectangle from ()() width () height () colour ()This block draws a rectangle of the specified width, and height starting from the coordinate specified and fills it with the colour selected from the drop-down menu.
Fill round rectangle from ()() width () height () radius () colour ()This block draws a rectangle with rounded corners of the specified radius, width, and height starting from the coordinate specified and fills it with the colour selected from the drop-down menu.
Fill circle from center ()() radius () colour ()This block draws a circle of the specified radius with the coordinate specified as the center and fills it with the colour selected from the drop-down menu.
Fill ellipse from center ()() x length () y length () colourThis block draws an ellipse of the specified lengths of the x-axis and y-axis with the coordinate specified as the center and fills it with the colour selected from the drop-down menu.
Fill triangle: Point 1 ()() Point 2 ()() Point 3 ()() colour ()This block draws a triangle with the points specified as its vertices and fills it with the colour selected from the drop-down menu.
Draw rectangle from ()() width () height () colour ()This block draws a rectangle of the specified width, and height starting from the coordinate specified and sets the colour of its perimeter to the colour selected from the drop-down menu.
Draw round rectangle from ()() width () height () radius () colour ()This block draws a rectangle with rounded corners of the specified radius, width, and height starting from the coordinate specified and sets the colour of its perimeter to the colour selected from the drop-down menu.
Draw circle from center ()() radius () colour ()This block draws a circle of the specified radius with the coordinate specified as the center and sets the colour of the circumference to the colour selected from the drop-down menu.
Draw ellipse from center ()() x length () y length () colourThis block draws an ellipse of the specified lengths of the x-axis and y-axis with the coordinate specified as the center and sets its colour to the colourselected from the drop-down menu.
Draw triangle: Point 1 ()() Point 2 ()() Point 3 ()() colour ()This block draws a triangle with the points specified as its vertices and its colour to the colour selected from the drop-down menu.

If you want to know more on how to control TFT Display using evive, read this tutorial.

Share this Page
Facebook
Twitter
Google+
Pinterest
Reddit
Print
Related Tutorials
Featured Projects

Leave a Reply

Leave a Reply

Close Menu
×

Cart