Hi guys, I'm working on a user interface for a device. I would like to display a logo before I enter a main menu but I can't seem to make it work. The screen would be stucked at a white page when I compiled TFTBitmapLogo with my user interface code. I've ran several checks on the Micro SD Card and can confirm that it is functioning well. The SD card contains a logo.bmp file that is 160 x 128 in dimensions. The TFTBitmapLogo works on its own but not when compiled.
Here is the part of my code that is relevant. Where did I go wrong? =( =(
#include <SPI.h>
#include <SD.h>
#include <Keypad.h>
#include <TFT.h>
#include <Wire.h>
// pin definition for the Uno
#define sd_cs 4
#define cs 10
#define dc 9
#define rst 8
const byte ROWS = 2; //four rows
const byte COLS = 3; //three columns
char keys[ROWS][COLS] = {
{'1','2','3'},
{'4','5','6'}
};
byte rowPins[ROWS] = {2, 3}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {5, 6, 7}; //connect to the column pinouts of the keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
PImage logo;
char greenLED = A1;
char yellowLED = A0;
// create an instance of the library
TFT TFTscreen = TFT(cs, dc, rst);
// position of the line on screen
int xPos = 0;
void(* resetFunc) (void) = 0;//declare reset function at address
void setup(){
Wire.begin(4); // join i2c bus with address #4
Serial.begin(115200);
TFTscreen.begin();
pinMode(A1, INPUT);
pinMode(yellowLED, OUTPUT);
pinMode(2, INPUT);
pinMode(3, INPUT);
pinMode(5, INPUT);
pinMode(6, INPUT);
pinMode(7, INPUT);
//display logo
logo = TFTscreen.loadImage("logo.bmp");
int x = random(TFTscreen.width() - logo.width());
int y = random(TFTscreen.height() - logo.height());
TFTscreen.image(logo, x, y);
delay(1500);
// 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);
// Main menu
TFTscreen.text("-----Menu----",0,0);
TFTscreen.text("1: Record data", 0, 20);
TFTscreen.text("2: Test mode", 0, 40);
TFTscreen.setTextSize(2);
}