Running out of memory

Newbie so I can't post more than once in 5 minutes and have to leave soon. Will finish when I get back.

So I am trying to make a Arduino smart-ish watch using an Arduino pro mini, the Adafruit Bluefruit nrf8001 and the Adafruit 128x64 OLED black/white display. I have successfully paired the watch with my iPhone and received Apple Notification Center Service messages on the watch, however memory is getting low (<25%). When I try to add the Adafruit OLED library, the memory used is over 125%, so it can't upload. I am wondering if anybody has been able to shrink the Adafruit library, and/or has suggestions on how to further shrink the code. I have never had low memory issues so I'm not sure where to start. The code can be found here: GitHub - joshness02/ArduinoSmartWatch: The code I have currently for an Arduino-based Smart Watch

The adafruit library can be found here: Arduino Library & Examples | Monochrome OLED Breakouts | Adafruit Learning System

If anyone has suggestions that would be great, thanks!

128x64

Tiny monochrome screen, huh?
That's still 1024 bytes of RAM needed for a screen buffer, if you want speedy graphical output.
Text-only would require less RAM.

Thanks, do you know of a way to eliminate all other forms of graphics? I will try and add the code to GitHub, unable to post it here due to character limit :\

I added the code to GitHub, it can be found here:

If you just use text, you can get by without the weight of the graphics library by using

"SSD1306Ascii.h" "SSD1306AsciiAvrI2c.h"

I understand it makes a big difference.

Sorry, but could you go into a little more detail on what "SSD1306Ascii.h" and "SSD1306AvrI2C" are? Does this need to be included in my main file? Or do I need to edit the Adafruit library?

Perhaps I should have been more clear - they are alternative libraries that just do plain vanilla text.

Eample at Getting something useful from the SSD1306 OLED - Displays - Arduino Forum

U8G2 can work in a paged mode in which you only need 1/4th of the RAM. Renders stuff nicer as well :slight_smile:

Also note that all your String magic is NOT counted for in RAM use indicated by the IDE/compiler... Also easy to make Swiss cheese of your memory with String magic. If you would use strings on the other hand (no capital).

septillion:
U8G2 can work in a paged mode in which you only need 1/4th of the RAM. Renders stuff nicer as well :slight_smile:

...but slower.

So the SSD1306Ascii is working great on its own, however with my BLE code it does not work at all. I am using less than 70% memory (both storage and dynamic) with the Ascii library integrated, however if I initialize the display - the same way as in the (working) example - the program does not seem to run, there is no Serial output, and I don't see the bluetooth device on my iPhone. Any ideas on why this might be? I am using I2c the screen and SPI for the bluetooth module, so there shouldn't be any crosstalk between devices, correct? If this needs to be posted as a new question please let me know and I will do so.

Any ideas on why this might be?

There's a problem somewhere in the information and code you didn't provide.

AWOL:
...but slower.

In paged mode, for sure. As always a trade off. Not sure about speeds in full frame mode.

JoshN:
I am using less than 70% memory (both storage and dynamic) with the Ascii library integrated,

Note that 70% does only include global variables. Aka all variables in functions is added (or tried to) at run time. And we're not even talking about Strings....

Timo