Help creating menu for golf robot

@liudr

I have attempted to reconfigure the Phi_promt_example in the Ardunio IDE 1.0 using the Template_using_analog_keys.pde example for use with the DFRobot LCD Keypad Shield for Arduino.
Product code : RB-Dfr-07
http://www.robotshop.com/dfrobot-lcd-keypad-shield-arduino-1.html

But I'm getting some button response anomalies. The up key decrements by 2, whereas I'd presume 'up' would increment the variable. The down key doesn't do anything. The right key increments by 2. The left key acts the same as the select key. Both terminate the "input_integer(&myIntegerInput);" function call.

Any advice you could send through pointing me to how I can correct the button behaviour would be appreciated.

The code I am running is as follows:

#include <LiquidCrystal.h>
#include <Wire.h>
#include <stdio.h>
#include <avr/pgmspace.h>
#include <phi_interfaces.h>
#include <phi_prompt.h>

//DFRobot LCD shield pin setting
#define LCD_RS 8
#define LCD_EN 9
#define LCD_D4 4
#define LCD_D5 5
#define LCD_D6 6
#define LCD_D7 7

//DFRobot LCD shield row & column assignments
#define lcd_rows 2
#define lcd_columns 16

#define analog_buttons_per_column 5 // Each analog pin has five buttons with resistors.
#define analog_buttons_per_row 1 // There are two analog pins in use.

#define name_length 8 // This is the max length of names.

char analog_mapping[]={'U','D','L','R','B'}; // This is an analog keypad.
byte analog_pins[]={0}; // The pin numbers are analog pin numbers.
int values[]={0, 144, 342, 505, 742}; //These numbers need to increase monotonically. The 342 works better on my setup but you will need to change it back.
phi_analog_keypads analog_keypad(analog_mapping, analog_pins, values, analog_buttons_per_row, analog_buttons_per_column);


// This serial keypad is for debugging.
phi_serial_keypads debug_keypad(&Serial,9600);

// The following sets up function keys for phi_prompt library
char up_keys[]={"U"}; ///< All keys that act as the up key are listed here.
char down_keys[]={"D"}; ///< All keys that act as the down key are listed here.
char left_keys[]={"L"}; ///< All keys that act as the left key are listed here.
char right_keys[]={"R"}; ///< All keys that act as the right key are listed here.
char enter_keys[]={"B"}; ///< All keys that act as the enter key are listed here.
char escape_keys[]={"A"}; ///< All keys that act as the escape key are listed here.
char * function_keys[]={up_keys,down_keys,left_keys,right_keys,enter_keys,escape_keys}; ///< All function key names are gathered here fhr phi_prompt.

// The following adds all available keypads as inputs for phi_prompt library
multiple_button_input * keypads[]={&analog_keypad, &debug_keypad,0};

// The following sets up LCD and other objects
LiquidCrystal lcd(LCD_RS,LCD_EN,LCD_D4,LCD_D5,LCD_D6,LCD_D7); // Create the lcd object

void setup()
{
    lcd.begin(lcd_columns, lcd_rows);
    init_phi_prompt(&lcd,keypads,function_keys, lcd_columns, lcd_rows, '~'); // Supply the liquid crystal object, input keypads, and function key names. Also supply the column and row of the lcd, and indicator as '>'. You can also use '\x7e', which is a right arrow.
    Serial.begin(9600); // Serial is used as a debug keypad. This can be deleted after debug.
}

void loop()
{
int user_input=10;                        // This is the storage for the integer
phi_prompt_struct myIntegerInput;         // This struct stores information for library functions
myIntegerInput.ptr.i_buffer=&user_input;  // Pass the address of user_input to the library.
// After library function call, user input will be stored in this variable. Note the use of “&”.
myIntegerInput.low.i=0;                   // Lower limit. The number wraps to 20 when decreased from 0.
myIntegerInput.high.i=20;                 // Upper limit. The number wraps to 0 when increased from 20.
myIntegerInput.step.i=2;                  // Step size. You will get 0, 2, 4, 6, 8, etc if you set it to 2.
myIntegerInput.col=7;                     // Display the number at column 7 myIntegerInput.row=1; // Display the number at row 1
myIntegerInput.width=2;                   // The number occupies 2 character space.
myIntegerInput.option=0;                  // Option 0, space pad right, 1, zero pad left, 2, space pad left.
lcd.clear();                              // Clear the lcd.
lcd.print("Number(0-20):");               // Prompt user for input
input_integer(&myIntegerInput);           // This calls the library function.
/*
The initial number will be displayed first and the functions waits for the user to press up/down to change 
the number and enter to confirm, after which it stores the new number in user_input. Notice the "&" in front 
of the myIntegerInput struct.
*/

Serial.print("user_input was: ");
Serial.println(user_input);


}