I have a problem, i think it's quite simple to solve, but don't know how to do it.
1) On a 16*2 lcd, i want to implement a menu (think i have found a way to do that, that's not my problem)
2)In every menu-item, i want to display up to four words. Each word represents an option in the menu. When selecting an option, an action should happen (go to next menu item, or do some i/o stuff)
3)Before each option, there's a space, and i've created a special character (=an arrow >).
4)at startup, the arrow should point to the first option. The first option starts always on cursor position (0,1), so i've space in the upper left corner for the arrow.
5) When you press the menu-option-button, the arrow should point to the next option on the first line. (don't know where this is, depends on the length of each option-word). If there are 3 or 4 options on the display, the arrow should move further when the button is pressed again
6)When the select button is pressed, the subsequent action should be performed
My question: What's the most efficiënt way to move the pointer around on the screen? Don't have an OOP language it's for Just Another Language. I've made a method/function that erases the arrow and places it on another position. (i.e movecursortonewposition(new collumn position, new row position).
I need something like a for loop, but only loop through it once when the button is pressed, and that for max 4 times? How to know where to put the pointer for option nr 2 and 4 wich are on the right side? The position is depends on the length of the words for options 1 and 3 which are one the left on the display?