Need pointing in the right direction (TFT diplay)

Hello i have a LCD TFT display the same as the one in this link:
http://www.ebay.com/itm/1PC-2-2-Inch-SPI-TFT-LCD-Serial-Port-Module-Display-ILI9341-5V-3-3V-New-/271288163472?pt=LH_DefaultDomain_0&hash=item3f2a08dc90

I have wired it up to my Arduino Mega 2650 the same as in this picture:

and i am using this code to try and test it:

/*
  Arduino TFT text example
  
  This example demonstrates how to draw text on the 
  TFT with an Arduino. The Arduino reads the value 
  of an analog sensor attached to pin A0, and writes 
  the value to the LCD screen, updating every
  quarter second.
  
  This example code is in the public domain

  Created 15 April 2013 by Scott Fitzgerald
 
  http://arduino.cc/en/Tutorial/TFTDisplayText
 
 */

#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);
}

But all i am getting is a blue screen on the LCD when i plug it in and nothing changes even when i load the code on.

Any ideas? i don't have a shield is this the reason?

The TFT Library is based on this:

Which if you read says that it is designed for "1.8" Displays". Presumably very specific displays at that.

Don't expect all TFT displays to be made equal.

Your display has a ILI9341 controller. As Tom said: This is not compatible with the ST7735. The internal TFT.h will not work.

Your type of display had been part of my small report here:
http://forum.arduino.cc/index.php?topic=222327.msg1617891
Ucglib (which also supports the ILI9341) is attached to that thread. Reference manual for Ucglib is here Google Code Archive - Long-term storage for Google Code Project Hosting.

There are some problems to connet this display to 5V Arduino Boards. This is discussed here:
http://forum.arduino.cc/index.php?topic=181679.0

Oliver

Ok thank you for the help, have just wired the screen up as instructions say and then moved onto the programming but i am getting an error coming up. I no this is most likely just me doing something wrong but what is it?

Thanks

Where did you download Ucglib? How did you install Ucglib?

Oliver

Oh think I downloaded version 0.01 will give it a go with 0.02 now is that the most up to date? And extracted it and but it in the library folder in the arduino program files

If Ucglib is installed correctly, it should also provide some examples in the IDE menus.
It should also be possible to install Ucglib via the IDE library install feature.

Oliver

Hmm have tried both ways a few times now and no luck

3056rf:
Hmm have tried both ways a few times now and no luck

You still get the same compiler error? You might need to remove version 0.01 of Ucglib manually.

Oliver

I have deleted 0.01 from the library and restarted everything but still not working for some reason. Is there anything else i have to do to uninstall it manualy?

You still get the same error? Or: What is the current error?
How did you install ucglib?

Oliver

Just trying it again now. is there a way to clear it from the contributed list in the library list before i start?

Right just had another play and i hadnt uninstaled the library properly so i manualy deleted it exited arduino software started it up again and added 0.02 and the scetch complied and went onto the arduino!! great only problem is its still not working lol Do i have to have the SPI pins in for it to work? and is sdi (mosi) also know as data? and it says sck on my board instead of sclk is all this ok? if so think the board is blown/faulty

data = mosi = sdo = many other names
same is true for the clk signal.

With sw SPI you can use any pin of the Board.

Oliver

Does SPI need to be connected for it to work though?

Not exactly sure about the meaning of your question: SPI is a protocol, that is used by the display. For sure the connection is required. But you can choose between HW SPI (= you must use specific pins of the Arduino Board) or SW SPI (use any pins and tell the library which pins are used)

Oliver

The Elec Freaks Shield works with the mega as well as the uno right?

as far as i remember, yes
Oliver

Ok sweet, is this pretty much the same as the elec freak one?

http://www.ebay.co.uk/itm/SainSmart-TFT-LCD-Adjustable-Shield-Expansion-Board-For-Arduino-Mega2560-R3-/350918091142?pt=UK_BOI_Electrical_Components_Supplies_ET&hash=item51b4592186

Hm, the shield from ebay looks very different. So i would say, it is not the same. But it might still work.

Oliver

Edit: You should ensure, that the TFT fits to the shield.