binary input from analog potentiometer?

const int threshold = 127;
const int center = 1023/2;

const uint8_t xPin = A2;
const uint8_t yPin = A1;

void loop() {
  int xVal = analogRead (xPin);
  int yVal = analogRead (yPin);

  bool left = xVal < (center - threshold);
  bool right = xVal > (center + threshold);

  bool down = yVal < (center - threshold);
  bool up = yVal > (center + threshold);
}

Pieter