Introduction: How to Use 2.4" TFT LCD Shield With Arduino Mega

About: My name is Bay Yolal, hello everybody!

Today, I am going to show you that we want to use 2.4" TFT LCD shield (There is mcufriend.com writes on this shield) works with Arduino Mega, because it is not so easy to run each other. But with this instructions, you can run and modify codes easily according to this tutorial.

Step 1: Assembly

This step is very easy. But please focus on Arduino Mega's Power side's Vin and between Analog In's A0 pins. This gap is our referance point to put this shield on Arduino Mega.

Step 2: Upload the Code

<p>#include  <Adafruit_GFX.h>   </p><p>#include "SWTFT.h" </p><p>#define LCD_CS A3 
#define LCD_CD A2 
#define LCD_WR A1 
#define LCD_RD A0 </p><p>SWTFT tft;</p><p>void setup(void) {
  Serial.begin(9600);
  Serial.println("TFT LCD Shield Test");</p><p>  tft.reset();</p><p>  uint16_t identifier = tft.readID();
  Serial.print("Your LCD driver chip name is: ");
  Serial.println(identifier, HEX);
  tft.begin(identifier);
  Serial.println("Working Well");
}</p><p>void loop(void) {
  for(uint8_t rotation=0; rotation<4; rotation++) {
    tft.setRotation(rotation);
    testText();
    delay(2000);
  }
}</p><p>unsigned long testText() {
  tft.fillScreen(0x0000);
  unsigned long start = micros();
  tft.setCursor(0, 0);
  tft.println();
  tft.setTextColor(0xFFFF);  tft.setTextSize(3);
  tft.println("Hello World!");
  tft.println();
  tft.setTextColor(0xFFE0); tft.setTextSize(2);
  tft.println("A Yellow Text Here");
  tft.println();
  tft.setTextColor(0x07E0);
  tft.setTextSize(3);
  tft.println("A Green Text Here");</p><p>  return micros() - start;
}</p>

On your Arduino IDE, select your COM port, select your board as Arduino Mega. Then upload these codes into your Arduino Mega board. You will see your codes are simply working.

Step 3: Necessary Libraries

1. Download libraries.rar file.

2. Go to start >> libraries >> Arduino >> Libraries >> paste these two files in there.

3. Paste the code from a step ago it was given to Arduino IDE screen

4. The library is normally for Arduino UNO, to make it work with Arduino MEGA go to the library folder and find SWTFT.cpp file and open it with notepad >> Find these code:

// Use the include which corresponde to your arduino

If you want to use your 2.4" TFT LCD Shield works with only Arduino MEGA uncomment this line as deleting //

//	#include "mega_24_shield.h"

If you want to use your 2.4" TFT LCD Shield works with only Arduino UNO uncomment this line as deleting //

//	#include "uno_24_shield.h"

Save and close, then return to Arduino IDE and enjoy :D

Step 4: Other Informations

This work is depending on these materials:

  • Code provided by Smoke And Wires
  • http://www.smokeandwires.co.nz
  • This code has been taken from the Adafruit TFT Library and modified
  • By us for use with our TFT Shields / Modules
  • For original code / licensing please refer to //http://www.smokeandwires.co.nz

Note: I only edit these codes to make all easy for beginners and who wants speed programming. But I also worked a little bit on it. Check the video above for original codes.

Note: I have solved this problem with help of this topic

Note: My old youtube video ison here

Note: Also on my website you may check the same informations.

.

That's all !

Step 5: BONUS: Reading This Instructable

NOTE: This instructable's step is aimed for visually impaired people to hear the sentences to learn what's going on here. Watch the video, it explains all steps.