Sistem Kerja Alat:
Arduino mengatur warna screen pada LCD Touch screen. Modul LCD yang digunakan adalah 2.4’’ TFT LCD Shield.
Kebutuhan Hardware :
- LCD 2,4’’ TFT SHIELD
- Modul Arduino UNO
- Power supply +9Volt
Diagram Blok:
Schematics
Koneksi Arduino UNO dengan modul LCD TFT 2’4” tinggal dipasangkan ke pin header Arduino, seperti shield2 yang lain. Koneksi Arduino UNO dengan modul TFT LCD Shield :
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);
}
Jalannya Alat :
1. Pastikan library TFT LCD sudah terinstal.
2. Upload program diatas.
3. Kondisi awal LCD menampilkanwarna Hitam selama 2 detik.
4. Selanjutnya menampilkan warna Merah selama 2 detik, dan seterusnya.
Video Project I.15. Animasi Warna menggunakan LCD Touch Screen
KAMI MELAYANI JASA PEMBUATAN HARDWARE ATAU SOFTWARE BERBASIS ARDUINO
KONTAK KAMI 085743320570 (adi sanjaya)
No comments:
Post a Comment