Controlling an ISD1932 Voice Recorder with an Accelerometer - Advice please.

Hello Open Sourcers,
I would like to control an ISD1932

with an ADXL335.

So that when the unit it upright it plays and when it is tilted 90degrees in any direction it records.

So far I have followed the tutorial that explains how to get readings from the accelerometer.

The problem comes when I try to control an LED with an IF/ELSE statement regarding the X axis.
The LED constantly stays on with my current code and I'm not sure why.

/*
 ADXL3xx
 
 Reads an Analog Devices ADXL3xx accelerometer and communicates the
 acceleration to the computer.  The pins used are designed to be easily
 compatible with the breakout boards from Sparkfun, available from:
 http://www.sparkfun.com/commerce/categories.php?c=80

 http://www.arduino.cc/en/Tutorial/ADXL3xx

 The circuit:
 analog 0: accelerometer self test
 analog 1: z-axis
 analog 2: y-axis
 analog 3: x-axis
 analog 4: ground
 analog 5: vcc
 
 created 2 Jul 2008
 by David A. Mellis
 modified 30 Aug 2011
 by Tom Igoe 
 
 This example code is in the public domain.

*/

// these constants describe the pins. They won't change:
const int groundpin = 18;             // analog input pin 4 -- ground
const int powerpin = 19;              // analog input pin 5 -- voltage
const int xpin = A3;                  // x-axis of the accelerometer
const int ypin = A2;                  // y-axis
const int zpin = A1;                  // z-axis (only on 3-axis models)
const int ledPin = 13;
void setup()
{
  // initialize the serial communications:
  Serial.begin(9600);
  
  // Provide ground and power by using the analog inputs as normal
  // digital pins.  This makes it possible to directly connect the
  // breakout board to the Arduino.  If you use the normal 5V and
  // GND pins on the Arduino, you can remove these lines.
  pinMode(groundpin, OUTPUT);
  pinMode(powerpin, OUTPUT);
  digitalWrite(groundpin, LOW); 
  digitalWrite(powerpin, HIGH);
  
  pinMode(ledPin, OUTPUT);
}

void loop()
{
  // print the sensor values:
  Serial.print(analogRead(xpin));
  // print a tab between values:
  Serial.print("\t");
  Serial.print(analogRead(ypin));
  // print a tab between values:
  Serial.print("\t");
  Serial.print(analogRead(zpin));
  Serial.println();

   if (xpin < 500)
  {
  digitalWrite(ledPin, HIGH);
}
if (xpin > 500)
{
  digitalWrite(ledPin, LOW);
}
  // delay before next reading:
  delay(100);
}

Thanks in advance for your help.

const int xpin = A3;                  // x-axis of the accelerometer
...
   if (xpin < 500)
  {
  digitalWrite(ledPin, HIGH);
}
if (xpin > 500)
{
  digitalWrite(ledPin, LOW);
}

How often does xpin get above 500?

You might want to use the value read from the pin, rather than the number of the pin.

Thanks for the pointer. This is working a treat.

   if (analogRead(xpin) < 500)
  {
  digitalWrite(ledPin, HIGH);
}
if (analogRead(xpin) > 500)
{
  digitalWrite(ledPin, LOW);
}

I want the BOB-10653 to record when the device is tilted past 30 degrees and play when it tilts back. Is this even possible? I'm having great difficulty getting it to work at all.

I want one recording only.
I'm using a 100k resistor on the ROSC at the moment.

Apart from that I don't know if I should use Address or Direct as I do not understand the Data Sheet.
I could do with some advice on where to go from here.