can you load image data from sd card and desplay on 128x64 I2C OLED screen

Just a question to those with better experience in C++ and Arduino than I to see if this is a possibility

I have a 128x64 I2C screen I got off of ebay (this one: http://www.ebay.co.uk/itm/181773588967) and can use it to display pictures and stuff by using PROGMEM arrays, however this does not help me because I have too many images than will fit in flash memory, i have attempted to change this into an array that can be changed (so stored in ram not flash) by taking out the PROGMEM part

the reason for this is that i want to display lots of pictures or in my case qrcode images which works pretty well for one or two using PROGMEM

when I change the array so that it can be changed in ram it just displayed a garbled mess on the screen.

even if I remove the sd card read code and define the same data that works in PROGMEM space in ram by taking out the PROGMEM and compiling, uploading and running it again it still produces a garbled mess

my idea was to save the char data to files on an sd card, load the data in when required and populate the array then push this array to the OLED as with what is done with the PROGMEM array. However I cannot get it to work

any ideas on feasibility, I think I may have to make an adjustment to the library’s that i’m using to accomplish this but as my c++ is limited I am not sure where to begin

any and all help greatly appreciated :slight_smile:

very shabby test code below:

unsigned char Test[]  = { };


#include <SPI.h>
#include <SD.h>

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define OLED_RESET 4
#define DEBUG

Adafruit_SSD1306 display(OLED_RESET);

const byte chipSelect = 4;


void setup() {
  // put your setup code here, to run once:
#ifdef DEBUG
  Serial.begin(9600);
#endif

  // for sd card compatibility only
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
  //mega
#ifdef DEBUG
  Serial.println(F("MEGA"));
#endif
  pinMode(53, OUTPUT);

#elif defined(__SAM3X8E__)
  //due
#ifdef DEBUG
  Serial.println(F("DUE"));
#endif

#elif defined(__AVR_ATmega328P__)
  //uno

#ifdef DEBUG
  Serial.println(F("UNO"));
#endif

  pinMode(10, OUTPUT);
#endif

#ifdef DEBUG
  Serial.print(F("Initializing SD card..."));
#endif

  // see if the card is present and can be initialized:
  if (!SD.begin(chipSelect)) {
    #ifdef DEBUG
    Serial.println(F("Card failed, or not present"));
    #endif
    
    // don't do anything more:
    return;
  }
  #ifdef DEBUG
  Serial.println(F("card initialized."));
#endif

  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);

LoadTime(0000);


  display.clearDisplay();
  display.drawBitmap(0, 0, Test, 64, 64, 1); //load 64x64 image
  display.display();
  delay(5000);
  
}

void loop() {
  // put your main code here, to run repeatedly:


}


void LoadTime(char TimeID) {

  if (!SD.begin(chipSelect)) {
#ifdef DEBUG
    Serial.println(F("Card failed, or not present"));
    Serial.println(F("The program has been halted."));
#endif

    // don't do anything more:
    //return;
    for (;;);
  }
  else {
#ifdef DEBUG
    Serial.println(F("card initialized."));
#endif

    // open the file. note that only one file can be open at a time,
    // so you have to close this one before opening another.

    //            1234567
    char fn[8];// 999.qr last char is \n 2359.qr
    String str;
    str = F("/QRCodes/");
    str += String(TimeID);
    str.concat(F(".qr"));
    str.toCharArray(fn, str.length() + 1);

    //Serial.println(fn);
    //for (;;);
    File dataFile = SD.open(fn);

    if (dataFile) {
      int count = 0;
      while (dataFile.available()) {
        //Serial.print(dataFile.read());
        
// chr(clng("&HFF"))

//skipchar:
        char QRChar = dataFile.read();
  /*      switch (QRChar) {
          case char(13):
            //carridge return
            goto skipchar;
            break;
          case char(10):
            //line feed
            goto skipchar;
            break;
          default:
          */
            byte QRTile = char(QRChar); //byte(char(QRChar));

            Test[count] = QRTile; //byte(char(LevChar)-48);
            count += 1;
           // break;


            //DrawLevelToSerial();
            dataFile.close();
            //Serial.print(F("Pellets: "));
            //Serial.println(pelletCount);

     //   }
      }
    }
  }
}

// Convert normal decimal numbers to binary coded decimal
byte decToBcd(byte val)
{
  return ( (val/10*16) + (val%10) );
}
 
// Convert binary coded decimal to normal decimal numbers
byte bcdToDec(byte val)
{
  return ( (val/16*10) + (val%16) );
}