I'm using the screen from this link : http://www.buydisplay.com/default/spi-arduino-2-8-inch-tft-touch-shield-example-ili9341-for-mega-due-uno
In combination with an Arduino Uno R3.
The black shield is a kind of adapter shield between the arduino and the screen, but also has an SD card reader, so after trying and failing hopelessly with the screen I decided to remove the screen and just use the shield with SD card, but even that fails.
I tried the "Set pin 10 high" method, tried different chip select pins, different libraries even, but to no avail.
Current code (code example that they provided) :
/***************************************************
// Web: http://www.buydisplay.com
EastRising Technology Co.,LTD
Examples for ER-TFTM028-4 with Capacitive Touch Panel
Hardward SPI 4-Wire SPI Interface 5V Power Supply
****************************************************/
#include <Wire.h>
#include <GFX.h> // Core graphics library
#include "ILI9341.h" // Hardware-specific library
#include <SPI.h>
#include <SD.h>
// TFT display and SD card will share the hardware SPI interface.
// Hardware SPI pins are specific to the Arduino board type and
// cannot be remapped to alternate pins.
//Arduino DUE,Arduino mega2560,Arduino UNO
// The display also uses hardware SPI
#define TFT_CS 9
#define TFT_DC 7
ILI9341 tft = ILI9341(TFT_CS, TFT_DC);
#define SD_CS 8
void setup(void) {
Serial.begin(9600);
//tft.begin();
//tft.fillScreen(ILI9341_BLUE);
Serial.print("Initializing SD card...");
pinMode(10,OUTPUT);
digitalWrite(10,HIGH);
if (!SD.begin(SD_CS)) {
Serial.println("failed!");
}
Serial.println("OK!");
char bmp1[] = "1.bmp";
bmpDraw(bmp1, 0, 0);
delay(500);
}
void loop() {
}
With this as (kind of ironic "OK") as output:
Initializing SD card...failed!
OK!
Loading image '1.bmp'
File not found
The datasheet says that the SD_CS is on pin 8, so it should work.. But no luck..
I realise that there's already a lot of this online, but nothing I found yet works.
EDIT: The card is also formatted with sdcardformatter 4 and is 1GB