Problems with oled ssd1306 screen menu

Hello everyone

I started using XOD a week ago, i bought an oled screen ssd1306 128x62 to make some test with @bradzilla84 's library.
I am now trying to make a little menu that shows 3 parameters af a pid controller.
I don’t have a rotary encoder like EC11 yet, so i am using 3 microswitches: two to increment and decrement the parameter and one to cycle through the 3 parameters, so i can set them indipendently.
Now, i had some problem adding all the 3 lines of text on the screen; one line was fine, two gave me some problems, three gave me much problems: the screen was flashing or freezing.
Now i fixed the problems and i can visualize and change the parameters as i want, but i i add the pid controller in the program, when i upload it to arduino, it starts with the same problems as before: the screen flashes or freezes.

I am using Arduino UNO and i am uploading the program NOT in debug mode (it takes too much resources).
I suspect that the program is too heavy for Arduino Uno, but maybe there are other solutions.

I’ll attach the .xodball file, if someone wants to help me 3 Variable Oled Menu.xodball (24.6 KB)

try this, the lcd will be updated after sending the buffer, if it still doesn’t work instead of “any” use Need join-pulses node (eventually) or Combining DONE Pulses Into a Single Output

ps: forget to place a defer between any and clear

here use another way to update the lcd, but with another library

Thanks a lot for your help!

I tried your first solutions but without success, however i managed to improve the code: i used a different approach: instead of refreshing the screen with a cycle, i refresh it only when needed, so only when i press increment or decrement.
after a switch is pressed, i call the clear display node to clear the buffer, then its “done” pulse acts on the “pass if” nodes and updates all the 3 “draw text” nodes, so the number of the selected parameter changes, and i print on screen the other parameters too.
This way is surely more efficient, but strangely my problem persist. i tried to insert a clock node to make the onboard led blink avry second, and this is enough to break the program, making the screen to flash with the last image before the new opload, or, if i add more nodes, the screen freezes on the last image of the previous program uploaded.

i’ll attach the new version so you can see the changes, and if you have a ssd1306 oled screen you can try it yourself.
In the new version i made a patch with the blinking led function. If you don’t call it in the main the program works, if you call it, it breaks.

i’ll also take a look to your other suggestions. this is how far i have come for now

3 Variable Oled Menu Improved .xodball (27.9 KB)

you must prioritize the LED pulse, when it is complete update the LCD


I have made many tests and i found that the problem was indeed the lack of ram; 2KB was not enough.
I tested it by changing the dimensions of the screen from 128x64 to 128x32, an in this way it worked and i could add other functions as an indicator of the selected parameter.
The problem was that 1KB of memory was reserved for the screen buffer, 38% for the global variables and so only the 12% was free.
Now i have bought an Arduino Mega and it works without any problem at full resolution (128x64)

i’ll attach the new program, if someone wants to take a look and try it 3 Variable Oled Menu Improved with indicator .xodball (44.3 KB)