Rotary encoder menu

Hi all,

First post on the forum. I am using this code: Arduino Project Hub

I have mangaged to convert it to work with a OLED display and that's working great, I can also change the layout and design no problem.

What i need some guidance on is how to make new menus and how to alter the length of a menu, for instance giving more than 3 options in the language menu.

Any help much appreciated.

Folks would be better able to assist if they could see your code - which code being enclosed in code tags </> above the smilies and indented with t.

I tried to post it but it kept saying that the post was too long?

Can you extract a portion that's under the limit *and * illustrates your issue? Just getting an idea of the structure and the approach you've taken may enable someone to offer advice. The entire sketch can also be included as a .ino attachment to the post. If you're using canned code note that fact.

Attached the original code.

Thanks

Nokia5110MenuRotary.ino (8.87 KB)

Which Arduino are you running that on? That code uselessly pisses away resources wrapping string literals in instances of the String class. There IS a better way.

An example of your menu structure would be necessary. That code does not care how long a list of items is, so adding more or less doesn't APPEAR to be a problem.

Ah, well that doesn't sound good.

Currently I am testing it on an UNO but I hope to get it running on a pro mini.

How would I go about creating a better code. I have limited knowledge but happy to read and learn.

Cheers

How would I go about creating a better code.

Use c strings - NULL terminated arrays of chars - instead of Strings. A String has to wrap a string anyway. Save the wrapper space and the dynamic allocation/deallocation of memory by not using Strings. All the methods that a String provides are done so using standard string functions. Learn to use them.

Thanks for the heads up PaulS, Just a quick google has me thinking about how bad Strings are and how they effect the memory.

I still need to work out how to make new menus, and bigger menus, but I am sure others will have ideas on how to do that.

Cheers