Summary: The menu system is terrible, Cant add new items with the current system, butting the selection is incredibly temperamental. Need advice for a ceap dirty way to get it working fast. Efficiency etc not important.
Hi, Apologies In advance, I know someone posts something about a rotary encoder menu just about every week on here and I hoped I wouldn't have to be one of them.
My project uses an Arduino mega 2560, a i2c 4 lined LCD display and a cheap rotary encoder. Below is a circuit diagram.
Recently I've started a project requiring a very simple menu and adjustment settings. for instance:
- On initialization, it must have a scrolling list of items to select.
- On selection, the other options must disappear displaying a controllable value (with the rotary encoder) for the user to adjust
The code doesn't have to be fancy, or even efficient, therefore I made it with several if statements and a button counter. Depending on the position of the encoder it displays particular information, Every time the button is pressed it counts up on a counter, depending on the value of the counter, it displays a particular page of information. (basically a terrible array of info).
However for some reason, it never seems to want to work past page 2, and if I copy the code to add more page 1 menu items, it no longer works past a particular rotary position. (the libraries are a mess I know, however, I have checked and they are not the issue. I'm assuming I have been an idiot and there's a simple explanation, bad practice, stupid structure, etc. Any suggestions or help would be appreciated.
For some reason, it wouldn't let me post the code in a preferred way and apparently new users cant just attach a zip. so here's a google drive link, it's my first time posting, sorry to be such a pain. Let me know if anyone requires more info/ different files or better explination.
https://drive.google.com/drive/folders/1EqN8xG3RutTQJN7SVhNKkS4ipEDvBDb5?usp=sharing