Objective: To display a bitmap image in the middle of the screen
Problem: When increasing the x value to anything other than 0; it distorts the image beyond recognition.
Hardware being used: Arduino Mega2560, TFT display shield, 3.2" TFT Touch Display (240x320)
More info: The display of the image is just a small part of the project I'm working on, so I've isolated the code to confirm the problem isn't being caused by anything else (which it isn't). I'm using an SD card to store the image and it displays fine when the x value is 0 but as soon as I try an reposition it along the X axis it distorts (moving it along the Y axis causes no issues)
This is my first time displaying bitmaps from an SD card and I've found there's limited info on this topic online (at least for the hardware I'm using anyway), so any help / guidance is much appreciated. Thanks in advance.
#include <SPI.h>
#include <SdFat.h>
#include <UTFT.h>
#include <UTFT_SdRaw.h>
#define SD_CHIP_SELECT 53 // SD chip select pin(Arduino Mega)
SdFat sd;
UTFT myGLCD(ILI9341_16, 38, 39, 40, 41);
UTFT_SdRaw myFiles(&myGLCD);
void setup()
{
Serial.begin(115200);
delay(100);
bool mysd = 0;
while (!mysd)
{
if (!sd.begin(SD_CHIP_SELECT, SPI_FULL_SPEED))
{
Serial.println(F("Card failed, or not present"));
Serial.println(F("Retrying...."));
}
else
{
mysd = 1;
Serial.println(F("Card initialised."));
}
}
Serial.println(F("Initialising LCD."));
myGLCD.InitLCD();
myGLCD.clrScr();
}
void loop()
{
myFiles.load(10, 10, 210, 210, "myimage.RAW", 1, 0);
}