Menubackend

Hello,

I'm trying to build a menu based on an LCD that uses the menubackend library, but instead of using the up and down buttons, I'd like to use a potentiometer connected to an analog port.
I have developed some code that defines the choice, but I'm not able to map it to the button logic of the menubackend library (menu.moveUp() and menu.moveDown().

int sensorValue = analogRead(2);
int rangemax=3; // the first menu has 3 possible choices
int choice = map(sensorValue, 0, 1023, 1, rangemax);

Any suggestion?

Thanks,
Joaoabs

a rotary encoder would be ideal in my mind but with a pot your going to have to define ranges, for example

if(pot >= 0 && pot <=128) choice one
elseif(pot > 128 && pot <=256) choice two

then your going to have to figure out how to keep it from constantly trying to update it while its reading 1,2,3,4...128

Hi,

I already do the choice with the map command. The choice goes to the choice variable.
The difficulty I'm having is mapping the variable choice (which is an absolute position of the menu) into a relative option ((menu.moveUp() and menu.moveDown()).

Any ideas?

Thanks,
Joaoabs