binary input from analog potentiometer?

Pieter,

Thanks for taking the time to respond. I believe I understand your code, but I'm afraid I don't know how to use the boolean parameters. For example, here is a snippet of the code I'm trying to modify:

      {
        case UP_KEY:
          mode_select++;
          if (mode_select > numModes)  // wrap around menu
            mode_select = 1;
          break;
        case DOWN_KEY:
          mode_select--;
          if (mode_select < 1)         // wrap around menu
            mode_select = numModes;
          break;
        case LEFT_KEY:           // left and right keys do nothing in main menu
          break;
        case RIGHT_KEY:
          break;
        case SELECT_KEY:         // user has picked a menu item
          cur_mode = mode_select;
          break;
      }

Currently, the parameters UP_KEY, DOWN_KEY etc are defined in the global area at the start of the code as follows:

// define LCD/Keypad buttons
#define NO_KEY 0
#define SELECT_KEY 1
#define LEFT_KEY 2
#define UP_KEY 3
#define DOWN_KEY 4
#define RIGHT_KEY 5

I'd like to use the output from the joystick potentiometers to replace UP_KEY, DOWN_KEY, LEFT_KEY and RIGHT_KEY if possible. I'm not sure what to do with the bool values, though - I tried renaming "bool left" to "bool LEFT_KEY", but it threw the following errors:

StepIndexLA___11_21_17_c.ino: In function ‘void loop()’:
StepIndexLA___11_21_17_c.ino:88:18: error: expected unqualified-id before numeric constant
StepIndexLA___11_21_17_c.ino:167:8: note: in expansion of macro ‘LEFT_KEY’

Thanks again for your help!

Lee