Hello,
I'm having difficulty wrapping my brain around a project. I'm using a Mega 2560R3 with a 3.5TFTLCD. Bitmaps are downloaded on a micro SD card and show up using the code MCUFRIEND_kbv - showBMP_kbv_UNO
So I'm trying to utilize this code to display a bitmap when a digital pin reads HIGH.
Here is what I added to the code to far:
int buttonPin = 31; // show BrakeLampOut.bmp
int buttonPin = 33; // show LF.bmp
int buttonPin = 35; // show HeadlampOut.bmp
int buttonPin = 37; // show LowWiperFluid.bmp
int buttonPin = 39; // show LR.bmp
int buttonPin = 41; // show RF.bmp
int buttonPin = 43; // show RR.bmp
int buttonPin = 45; // show TailLampOut.bmp
int buttonPin = 47; // show Trunk.bmp
How/where would I write the if statements to trigger a bitmap when a digital pin receives 5v?
Also, is creating a home screen possible??? ...if none of the digital input are on, then display _____.bmp
I'm sure it's simple, but I've been drinking from the proverbial firehose of all things arduino 
Any thoughts? Should I ditch the MCUFRIEND code and try something else?
const int buttonPin1 = 31;
const int buttonPin2 = 33;
const int buttonPin3 = 35;
int buttonState1 = 0;
int buttonState2 = 0;
int buttonState3 = 0;
#include <SPI.h> // f.k. for Arduino-1.5.2
#define USE_SDFAT
#include <SdFat.h> // Use the SdFat library
SdFatSoftSpi<50, 51, 52> SD; //Bit-Bang on the Shield pins
#include <Adafruit_GFX.h> // Hardware-specific library
#include <MCUFRIEND_kbv.h>
#define SD_CS 10
MCUFRIEND_kbv tft;
#define PALETTEDEPTH 8 // support 256-colour Palette
char namebuf[32] = "/"; //BMP files in root directory
File root;
int pathlen;
void setup() {
pinMode(buttonPin1, INPUT);
pinMode(buttonPin2, INPUT);
pinMode(buttonPin3, INPUT);
uint16_t ID;
Serial.begin(9600);
Serial.print("Show BMP files on TFT with ID:0x");
ID = tft.readID();
Serial.println(ID, HEX);
if (ID == 0x0D3D3) ID = 0x9481;
tft.begin(ID);
tft.fillScreen(0x001F);
tft.setTextColor(0xFFFF, 0x0000);
bool good = SD.begin(SD_CS);
if (!good) {
Serial.print(F("cannot start SD"));
while (1);
}
root = SD.open(namebuf);
pathlen = strlen(namebuf);
}
Here is what i have so far…
}
if (buttonState3 == HIGH){
#define NAMEMATCH "TrunkOpen"
char *nm = namebuf + pathlen;
File f = root.openNextFile();
uint8_t ret;
uint32_t start;
if (f != NULL) {
#ifdef USE_SDFAT
f.getName(nm, 32 - pathlen);
Serial.print(f.getName(nm, 32 - pathlen));
#else
strcpy(nm, (char *)f.name());
#endif
f.close();
strlwr(nm);
if (strstr(nm, ".bmp") != NULL && strstr(nm, NAMEMATCH) != NULL) {
Serial.print(namebuf);
Serial.print(F(" - "));
tft.fillScreen(0);
start = millis();
ret = showBMP(namebuf, 5, 5);
switch (ret) {
case 0:
Serial.print(millis() - start);
Serial.println(F("ms"));
delay(5000);
break;
case 1:
Serial.println(F("bad position"));
break;
case 2:
Serial.println(F("bad BMP ID"));
break;
case 3:
Serial.println(F("wrong number of planes"));
break;
case 4:
Serial.println(F("unsupported BMP format"));
break;
case 5:
Serial.println(F("unsupported palette"));
break;
default:
Serial.println(F("unknown"));
break;
}
}
}
else root.rewindDirectory();
}
and an example of one of my if statements.