Adafruit OLED library Nano memory issue

Hello All.

I'm running into 'Not enough memory' when compiling a sketch using the Adafruit Oled library and a Nano with a 168 processor. Investigation has led me to think that the cause of the problem is the size of the library. I have no need for graphics in this project; text only. Is there any way to pare down the library? Code below. Thanks - Scotty

[code]
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);

#define NUMFLAKES 10
#define XPOS 0
#define YPOS 1
#define DELTAY 2

int offset = 5;
boolean LEDS_ON = false;




#define LOGO16_GLCD_HEIGHT 16
#define LOGO16_GLCD_WIDTH  16
static const unsigned char PROGMEM logo16_glcd_bmp[] =
{ B00000000, B11000000,
  B00000001, B11000000,
  B00000001, B11000000,
  B00000011, B11100000,
  B11110011, B11100000,
  B11111110, B11111000,
  B01111110, B11111111,
  B00110011, B10011111,
  B00011111, B11111100,
  B00001101, B01110000,
  B00011011, B10100000,
  B00111111, B11100000,
  B00111111, B11110000,
  B01111100, B11110000,
  B01110000, B01110000,
  B00000000, B00110000
};

#if (SSD1306_LCDHEIGHT != 64)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif
//TMP36 Pin Variables
int sensorPin1 = 15; //the analog pin the TMP36's Vout (sense) pin is connected to
//the resolution is 10 mV / degree centigrade with a 500 mV offset to allow for negative temperatures
int sensorPin2 = 16; //Ditto
float temperature1F;
float temperature2F;
float temperature1C;
float temperature2C;
int reading1;
int reading2;
float voltage1;
float voltage2;
float cable_loss_voltage = .03;


void setup()
{
  Serial.begin(9600);
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);  // initialize with the I2C addr 0x3D (for the 128x64)
  //display.display();
  delay(2000);
  display.clearDisplay();
  delay(2000);
}

void loop()
{
  
  //getting the voltage reading from the temperature sensor
  reading1 = analogRead(sensorPin1);
  reading2 = analogRead(sensorPin2);
  // converting that reading to voltage, for 3.3v arduino use 3.3
  voltage1 = ((reading1 * 5.0) + cable_loss_voltage);
  voltage1 /= 1024.0;
  voltage2 = ((reading2 * 5.0) + cable_loss_voltage);
  voltage2 /= 1024.0;
  // convert voltage to temperature
  temperature1C = (voltage1 - 0.5) * 100 ;  //converting from 10 mv per degree with 500 mV offset
  //to degrees ((voltage - 500mV) times 100)
  temperature2C = (voltage2 - 0.5) * 100 ;  //converting from 10 mv per degree with 500 mV offset
  //to degrees ((voltage - 500mV) times 100)
  // now convert to Fahrenheit
  temperature1F = (temperature1C * 9.0 / 5.0) + 32.0;
  temperature2F = (temperature2C * 9.0 / 5.0) + 32.0;
  if(temperature1F > (temperature2F + offset)){
    LEDS_ON = true;
  }
  else{
    LEDS_ON = false;
  }

  /*Serial.print("Sensor 1");
  Serial.print("\t");
  Serial.print(reading1);
  Serial.print("\t");
  Serial.print(voltage1);
  Serial.print("\t");
  Serial.print(" volts");
  Serial.print("\t");
  Serial.print(temperature1C);
  Serial.print(" degrees C");
  Serial.print("\t");
  Serial.print(temperature1F);
  Serial.println(" degrees F");

  Serial.print("Sensor 2");
  Serial.print("\t");
  Serial.print(reading2);
  Serial.print("\t");
  Serial.print(voltage2);
  Serial.print("\t");
  Serial.print(" volts");
  Serial.print("\t");
  Serial.print(temperature2C);
  Serial.print(" degrees C");
  Serial.print("\t");
  Serial.print(temperature2F);
  Serial.println(" degrees F");
  */

  display.clearDisplay();
  Serial.println(" HERE ");
  display.setTextSize(2);
  display.setTextColor(WHITE);
  display.setCursor(0, 0);
  display.print("Head: ");
  
  display.print(temperature1F,0);
  //display.println("'F");
  display.setCursor(0, 25);
  display.print("Cntrl:");
  Serial.println(" THERE  ");
  display.print(temperature2F,0);
  if(LEDS_ON){
  display.setCursor(18, 50);
  display.print("LEDS ON");
  }
  else{
    display.setCursor(14, 50);
  display.print("LEDS OFF");
  }
  Serial.println(" EVERYWHERE ");
  display.display();
 delay(1000);                                    
}

[/code]

The problem is you have a pixel display where a character display would do, so to draw a character on screen with a pixel display you need about 8x times more memory to define the character matrix than for a character display. You will also need to keep the display buffered in RAM and for a 128x64 monochrome display that's 1024 bytes.
It might be simpler to replace the display with an LCD.

You don't need a different display. If you don't need graphics then use an ascii-only library for the 1306. The SSD1306Ascii text-only library uses less than 100 bytes of RAM and also requires only a fraction of the code space as compared to the Adafruit graphics library. It is also well documented.

Recent thread about it: Rewrite of the SSD1306Ascii text only library - Displays - Arduino Forum

If you want both graphics and less RAM usage use u8glib.

Thanks jboyton, the SSD1306Ascii text-only library is great for text only. - Scotty