Drawing with LCD Touch screen with various color variations. The LCD module used is 2.4 '' TFT LCD Shield.
Hardware Requirement
- LCD 2,4’’ TFT Shield with Touch Screen Module
- Arduino UNO
- Power supply +5 Volt
LCD 2,4’’ TFT Shield with Touch Screen Module (Source)
Block diagram
Schematic
Arduino - LCD 2.4" TFT Wiring
LCD 2.4" TFT Module is compatible with Arduino Uno, so you just plug in to the top of Arduino with All of pin connected, Like image below.
Source Code/Sketch
#include <Adafruit_GFX.h>
#include <Adafruit_TFTLCD.h>
#define LCD_CS A3
#define LCD_CD A2
#define LCD_WR A1
#define LCD_RD A0
#define LCD_RESET A4
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);
void setup(void) {
tft.reset();
uint16_t identifier = tft.readID();
if(identifier==0x0101)identifier=0x9341;
tft.begin(identifier);
}
void loop(void) {
tft.fillScreen(BLACK);
delay(2000);
tft.fillScreen(RED);
delay(2000);
tft.fillScreen(GREEN);
delay(2000);
tft.fillScreen(BLUE);
delay(2000);
tft.fillScreen(YELLOW);
delay(2000);
tft.fillScreen(MAGENTA);
delay(2000);
tft.fillScreen(CYAN);
delay(2000);
tft.fillScreen(WHITE);
delay(2000);
}
#include <Adafruit_TFTLCD.h>
#define LCD_CS A3
#define LCD_CD A2
#define LCD_WR A1
#define LCD_RD A0
#define LCD_RESET A4
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);
void setup(void) {
tft.reset();
uint16_t identifier = tft.readID();
if(identifier==0x0101)identifier=0x9341;
tft.begin(identifier);
}
void loop(void) {
tft.fillScreen(BLACK);
delay(2000);
tft.fillScreen(RED);
delay(2000);
tft.fillScreen(GREEN);
delay(2000);
tft.fillScreen(BLUE);
delay(2000);
tft.fillScreen(YELLOW);
delay(2000);
tft.fillScreen(MAGENTA);
delay(2000);
tft.fillScreen(CYAN);
delay(2000);
tft.fillScreen(WHITE);
delay(2000);
}
How it Works
1. Connect the Arduino with Peripherals needed
2. Plug in the Power Source on the device
3. Compile and upload the script program above to your arduino
4. LCD will display a few colour which can choose for drawing colour
5. After you choose the colour, just draw it on the screen, and enjoy :)
6. CLR on the right corner is used to clear screen or delete drawing.
Video for Project I - 16. Paint Apps using LCD Touch Screen (Arduino Uno Based)
Download the required file.
No comments:
Post a Comment