No space in Arduino Nano?

Hi , i have a problem with a blockprogramming with OLED-Screen. If i select or use Oled 0.9" with a lot of functions, it can be uploaded to my robot. But if i wanna use an 1.3" Oled with even less code or function, it says no space. And there is nearly no difference in both Oled Codes except the Adafruit data. Whats very confusing is, that the includet data on 0.9", the Adafruit SSD1306.h is even bigger then SH1106.h for the 1.3". U guys have any idea?

Setup for OLED 0.9"
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define OLED_RESET -1 // sharing Arduino reset pin
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
void setup() {
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.clearDisplay();
display.display();
}
void loop() {
}

Setup for OLED 1.3"
#include <Adafruit_GFX.h>
#include <Adafruit_SH1106.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define OLED_RESET -1 // sharing Arduino reset pin
Adafruit_SH1106 display(OLED_RESET);
void setup() {
display.begin(SH1106_SWITCHCAPVCC, 0x3C);
display.clearDisplay();
display.display();
}
void loop() {
}

Please edit your post to add code tags, and post error messages as text rather than illegible screenshots.

The 128x64 display buffer take up half of the RAM in a Classic Nano (Uno, etc.). If you don't need graphics commands, use a text only library instead. GitHub - greiman/SSD1306Ascii: Text only Arduino Library for SSD1306 OLED displays

1 Like

But why is it no problem on 0.96" oled?

Sorry, I can't make sense of the illegible screenshots.

To improve your chances of getting help, please read and follow the instructions in the "How to get the best out of this forum" post.

1 Like

It says data sheet exceeds available space if i select oled 1. 3" but not when i select 0. 96", thats my problem. The thing is, that the code of both are nearly the same...

I imagine you're making this observation by eyeballing the number of "blocks" you have.

The reality is more complicated. Each "block" represents a set of "lower-down" code, and share of your Nano's resources. You might not see an obvious difference, but a lot is going on behind the scenes.

Using these displays with Nano is tight. I am not familiar with "blockprogramming", but I suspect it may not give you access to the level of complexity you will need to squeeze every last resource out of your Nano in order to use the displays effectively.

Without me having any specific knowledge of the topic, I would suggest moving to writing code with something like the Arduino IDE, so you can find different, more efficient ways to work with the displays.

Alternatively, throwing more resources at the problem, by using a more powerful Arduino, may put off the issue for now.

2 Likes

Here is the memory report when I compile for a Nano using SSD1306.h and Adafruit_SH1106.h... Adafruit takes more dynamic memory.

SSD1306:
Sketch uses 12972 bytes (42%) of program storage space. Maximum is 30720 bytes.
Global variables use 344 bytes (16%) of dynamic memory, leaving 1704 bytes for local variables. Maximum is 2048 bytes.

Adafruit_SH1106
Sketch uses 11074 bytes (36%) of program storage space. Maximum is 30720 bytes.
Global variables use 1357 bytes (66%) of dynamic memory, leaving 691 bytes for local variables. Maximum is 2048 bytes.
1 Like

That probably should be it.... Thank u guys

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.