LCD menu settings

hi all,

I’s wondering if there are any examples available, showing how an LCD (in combination with switches) can be used as a menu for adjusting various settings. You know, something similar to MIDI devices where you can change midi channels, midi CCs, etc…

I’ve been looking aroun for a while but can’t find anything …

thanks

Warp,
FWIW instead of switches, you might want to consider using a TV remote control. (There are examples of this on this forum.)

The TV remote makes it easy to navigate the "menus" on the display, and you don't have to lean over a press those tiny buttons :)!

John

thanks myname2,

looks impressive…

however, I in my case is more suitable to use “those tiny buttons” :slight_smile:

Hi Warp, this is how I do it

#define potPin             0  // the pin the pot is connected to
#define swPin              2  // pin switch is connected to
#define funcNbrFuncts  8  // the number of selectable user functions 
#define HYSTERESIS    4  // value to prevent jitter at the boundry of a function 

char * SelectionStrings[] = {"first", "second", "third","fourth","fifth","sixth", "seventh", "eigth" }; 

uint8_t ActiveSelection;      // this is a global variable holding option the user has selected 

void setup() {
    beginSerial (9600);
}
uint8_t GetUsrOption(){  
   int potvalue = analogRead(potPin);    // read the value from the Pot
   uint8_t opt = potvalue /(1024 / funcNbrFuncts);  //  divide 1024 max pot value by number of options
   if( opt >= funcNbrFuncts)    // checks to make sure we are in range
      opt = funcNbrFuncts -1;
   // now remove any pot jitter on the boundry of two options   
   if(opt == ActiveSelection -1)
      opt = (potvalue + HYSTERESIS) / (1024 / funcNbrFuncts) ;   // HYSTERESIS will maintain previous option when pot is on an option boundry
   else if(opt == ActiveSelection +1)
      opt = (potvalue - HYSTERESIS) / (1024 / funcNbrFuncts);    
   
   return opt;   
}

boolean DebounceSwitch(uint8_t pin) { 
  // this function returns true when a switch is pressed and stable
  // for simplicity I have removed the debounce code
    return digitalRead(pin);   
}

void loop(){
  if(DebounceSwitch(swPin)) {         
     ActiveSelection = GetUsrOption();  
     Serial.print( SelectionStrings[ActiveSelection]);
  }
}

In the example here i display the string using the serial port but in the real world the selection string is written to the LCD.

thanks mem,

i’ll have a look as soon as i return at home…