I have would like to inline a bmp file and store it on an sd card if it is not there.
I seem to have an issue writing all the data correctly.
bmp image array created using Littlevgl - Beginner's Photo Editor Blog
const PROGMEM char _BMP_FILE[] = { 0x01, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0xff, };
const PROGMEM char _LOGO_BMP[] = { "logo.BMP" };
This is done during setup()
if (!SD.exists((const __FlashStringHelper *)_LOGO_BMP)) {
//file missing - lets add it now.
File myFile = SD.open((const __FlashStringHelper *)_LOGO_BMP, FILE_WRITE);
myFile.print((const __FlashStringHelper *)_BMP_FILE);
myFile.close();
}
The file is created but it is empty. I'm sure it's something I'm not doing correctly. I assume the whole file is read and created, but I'm looking for any help you can provide.
Thank you