Home Code A 1.8 inch TFT Full Color LCD Display Module with Adapter Board for Arduino UNO

A 1.8 inch TFT Full Color LCD Display Module with Adapter Board for Arduino UNO

by shedboy71

In this article we look a shield which allows you to connect an Arduino Esplora TFT LCD to an Arduino Uno or Mega

The Graphic LCD screen is a backlit TFT LCD screen with headers. You can draw text, images, and shapes to the screen with the GLCD library.
There is an onboard micro-SD card slot on the back of the screen that can, among other things, store bitmap images for the screen to display.
The screen is 1.77″ diagonal, with 160 x 128 pixel resolution.
The TFT library interfaces with the screen's controller through SPI when using the TFT library.
The screen runs on +5 VDC
The micro-SD slot is accessible through the SD card library.
The LED backlight is dimmable by PWM.

Here is a picture of the shield and TFT

Parts

Only $6 for the shield and TFT

Part Link
Arduino Uno Arduino UNO R3
TFT shield and LCD 1.8 inch TFT Full Color LCD Display Module with LCD Adapter Board Expansion Board

Code

The TFT uses the built-in TFT library which comes with many examples that you can use to test with. The easiest one is the TFTDisplayText example

[codesyntax lang=”php”]

#include <TFT.h> // Arduino LCD library
#include <SPI.h>

// pin definition for the Uno
#define cs 10
#define dc 9
#define rst 8

// pin definition for the Leonardo
// #define cs 7
// #define dc 0
// #define rst 1

// create an instance of the library
TFT TFTscreen = TFT(cs, dc, rst);

// char array to print to the screen
char sensorPrintout[4];

void setup() {

// Put this line at the beginning of every sketch that uses the GLCD:
TFTscreen.begin();

// clear the screen with a black background
TFTscreen.background(0, 0, 0);

// write the static text to the screen
// set the font color to white
TFTscreen.stroke(255, 255, 255);
// set the font size
TFTscreen.setTextSize(2);
// write the text to the top left corner of the screen
TFTscreen.text(“Sensor Value :\n “, 0, 0);
// ste the font size very large for the loop
TFTscreen.setTextSize(5);
}

void loop() {

// Read the value of the sensor on A0
String sensorVal = String(analogRead(A0));

// convert the reading to a char array
sensorVal.toCharArray(sensorPrintout, 4);

// set the font color
TFTscreen.stroke(255, 255, 255);
// print the sensor value
TFTscreen.text(sensorPrintout, 0, 20);
// wait for a moment
delay(250);
// erase the text you just wrote
TFTscreen.stroke(0, 0, 0);
TFTscreen.text(sensorPrintout, 0, 20);
}

[/codesyntax]

Share

You may also like

Leave a Comment