Go Down

Topic: OLED Display Makes The Code Stuck  (Read 160 times) previous topic - next topic


May 15, 2019, 11:25 am Last Edit: May 15, 2019, 11:42 am by berkeozkir
Hey! I am using 128x64 oled display with Adafruit_SSD1306 library.

Whenever i try to use this algorithm if I write display.print("something") , my code get stuck.

Without this algorithm display work perfectly.

I think this problem might be about sketch memory or oled buffer...
My sketch memory is %99 :smiley-confuse: .

int sample=40;
int maxsample=50;
float alt[51];
float tim[51];


float tempo=millis();

for(int i = 1 ; i <= maxsample ; i++){

alt[maxsample]=altitude;  //altitude is variable from pressure sensor (pressure sensor works fine)!

float stime=tim[maxsample-sample];
float N1=0;
float N2=0;
float N3=0;
float D1=0;
float D2=0;

for(int i = (maxsample-sample) ;  i < maxsample ; i++){

float vario=0;    // reset old value

vario=1000*((sample*N1)-N2*N3)/(sample*D1 - D2*D2);       //set new value


You are probably running out of memory. The OLED library needs to set up a buffer for the whole screen which it then writes to the display when it's updated.


May 17, 2019, 10:14 pm Last Edit: May 17, 2019, 10:50 pm by berkeozkir
Thank You so much I couldn't have thought that. Now I have reduced the ram usage and it works like a charm.

Thanks Again!! :)


My OLED is also freezing, working fine for a while then locking up fro no apparent reason.
My sketch only uses 52% programme memory and 14% of Dynamic memory
May I ask. what steps did you take to reduce the RAM?
Should I also be looking at hardware issues?


My OLED is also freezing, working fine for a while then locking up fro no apparent reason.
You allocating anything in memory? Sounds like pointer issues to me.

-jim lee
PNW Ardiuno & Maker club
1012 9Th Street, Anacortes, WA 98221 (Around the back of building)

Go Up