How To Make LCD Shield Button Code Work with Pot I am trying to convert this code into something useable with a potentiometer and push button because I don't have a lcd shield and dont feel like wiring that many buttons.  I want the pot to have options 1-4 depending on resistance and the push button will select. However I don't understand the code so I was wondering if anyone new a good way to convert it.
Here is part of the code that I need to change:

    #define BUTTON_ADC_PIN           A0  // A0 is the button ADC input
#define LCD_BACKLIGHT_PIN         3  // D3 controls LCD backlight
// ADC readings expected for the 5 buttons on the ADC input
#define RIGHT_10BIT_ADC           0  // right
#define UP_10BIT_ADC            145  // up
#define DOWN_10BIT_ADC          329  // down
#define LEFT_10BIT_ADC          505  // left
#define SELECT_10BIT_ADC        741  // right
#define BUTTONHYSTERESIS         10  // hysteresis for valid button sensing window
//return values for ReadButtons()
#define BUTTON_NONE               0  // 
#define BUTTON_RIGHT              1  // 
#define BUTTON_UP                 2  // 
#define BUTTON_DOWN               3  // 
#define BUTTON_LEFT               4  // 
#define BUTTON_SELECT             5  //
I think what may be most helpful is an explanation of some tools which would serve you well on this.  In order to use the potentiometer to select different options, a simple solution would be along these lines:


Read the potentiometer value.
Check which range the value fits in.
Perform a corresponding action.


Here is one idea for accomplishing this:
Read the potentiometer value:

int reading = analogRead(A0);


Check which range the value fits in.

if(reading &lt; 1023/4){
    //Action 1
}else if(reading &lt; (1023/4)*2){
    //Action 2
}else if(reading &lt; (1023/4)*3){
    //Action 3
}else{
    //Action 4
}


Perform a corresponding action.

//Do something cool.