banner



How To Draw On Only Portion Of Lcd With Hysnc And Vsync

Components and supplies

Apps and online services

Ide web

About this project

You can read this and other amazing tutorials on ElectroPeak's official website

Overview

In this tutorial, you will learn how to use and set up 2.4″ Touch LCD Shield for Arduino. Commencement, you'll see some general information about this shield. And after learning how to set the shield upward, you'll meet three practical projects.

What You Will Acquire:

  • View text, writing and capricious geometric shapes with custom colors
  • View high-quality BMP colored pictures
  • create the Paint software

Arduino ii.4 Touch screen Shield Features

The office of screens in electronic projects is very of import. Screens tin be of very elementary types such as 7 Segment or graphic symbol LCDs or more advanced models like OLEDs and TFT LCDs.

Suggested Reading: Absolute Beginner'southward Guide to TFT LCD Displays by Arduino

ii.4" TFT shield is one of the nearly widely used graphic screens. Here are its virtually important features:

  • 240*320 pixels resolution
  • Ability to display 262000 different colors
  • Includes a touchpad
  • 5v supply voltage

Arduino pins 2, 3, A5, and A4 are free and yous tin apply them to connect this shield.

Required Libraries For two.four Touchscreen

Yous tin download the libraries in attachments

The TFTLCD library supports 932x, 7575, 9341, and HX8357D derivers.

If your LCD does non work with this library, try the Mcufriend_kbv.

The TFTLCD library supports 932x, 7575, 9341, and HX8357D derivers.

If your LCD does non piece of work with this library, try the Mcufriend_kbv.

Note To brandish stable images, we recommend you lot to utilize an adaptor instead of the USB port.

How to Calibrate the Bear on Screen?

One of the most of import features of this LCD is including a touch panel. If you are nearly to use the LCD, you demand to know the coordinates of the point you lot touch. To do so, you should upload the following code on your Arduino board and open up the serial monitor. Then bear upon your desired location and write the coordinates displayed on the serial monitor. You can employ this coordination in any other projection.

                              /*                                                  TFT LCD - TFT Touch Coordinate                                                  Based on Librery Case                                                  modified on 21 February 2019                                                  by Saeed Hosseini                                                  https://electropeak.com/learn/                                */                                #include <stdint.h>                                #include "TouchScreen.h"                                #define YP A2                                #define XM A3                                #define YM 8                                #define XP nine                                // For better pressure precision, we need to know the resistance                                // between Ten+ and Ten- Use any multimeter to read information technology                                // For the one we're using, its 300 ohms across the 10 plate                                TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);                                void setup(void) {                                                  Serial.begin(9600);                                }                                void loop(void) {                                                  TSPoint p = ts.getPoint();                                                  if (p.z > ts.pressureThreshhold) {                                                  Serial.print("X = "); Serial.print(p.x);                                                  Serial.print("\tY = "); Serial.print(p.y);                                                  Series.impress("\tPressure = "); Series.println(p.z);                                                  }                                                  delay(100);                                }                                          

TSPoint p = ts.getPoint(); stores the length (x), width (y) and pinch (z) in the p object.

Displaying Text and Shapes on Arduino 2.4 LCD

                              /*                                                  TFT LCD - TFT Unproblematic driving                                                  modified on 21 February 2019                                                  by Saeed Hosseini                                                  https://electropeak.com/learn/                                */                                #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 Bluish        0x001F                                #define RED         0xF800                                #define GREEN       0x07E0                                #define CYAN        0x07FF                                #ascertain MAGENTA     0xF81F                                #define Yellowish      0xFFE0                                #define WHITE       0xFFFF                                #ascertain Orange      0xFD20                                #define GREENYELLOW 0xAFE5                                #define NAVY        0x000F                                #ascertain DARKGREEN   0x03E0                                #ascertain DARKCYAN    0x03EF                                #define MAROON      0x7800                                #define Majestic      0x780F                                #define OLIVE       0x7BE0                                #ascertain LIGHTGREY   0xC618                                #ascertain DARKGREY    0x7BEF                                Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);                                void setup() {                                                  Serial.brainstorm(9600);                                                  Serial.println(F("TFT LCD examination"));                                #ifdef USE_ADAFRUIT_SHIELD_PINOUT                                                  Series.println(F("Using Adafruit 2.iv\" TFT Arduino Shield Pinout"));                                #else                                                  Serial.println(F("Using Adafruit 2.iv\" TFT Breakout Board Pinout"));                                

0 Response to "How To Draw On Only Portion Of Lcd With Hysnc And Vsync"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel