Accelometer Question

If I understand correctly, I have done something similar once. What you need to do is learn what values define "level." Use the "pulseIn(pin,state)" command, where "pin" is the pin your accelerometer's x or y axis is on and "state" is the logic level (this is usually high, or "1"). After getting these values from using "Serial.println(pulseIn(pin,1))", use if then statements. I will give an example:

//this is to get the values of "level"

const int xPin = 2;		// X output of the accelerometer
const int yPin = 3;		// Y output of the accelerometer


void setup()
{
   // initialize serial communications:
  Serial.begin(9600);
  // initialize the pins connected to the accelerometer
  // as inputs:
  pinMode(xPin, INPUT);
  pinMode(yPin, INPUT);
}

void loop()
{
  Serial.println(pulseIn(xPin,HIGH));
  Serial.println(pulseIn(yPin,HIGH));
  delay(500);
}

An example, with made-up numbers:

const int xPin = 2;		// X output of the accelerometer
const int yPin = 3;		// Y output of the accelerometer
const int red_led = 4;          //connect red LED here
const int blue_led = 5;         //Blue LED here


void setup()
{
   // initialize serial communications:
  Serial.begin(9600);
  // initialize the pins connected to the accelerometer
  // as inputs:
  pinMode(xPin, INPUT);
  pinMode(yPin, INPUT);
}

void loop()
{
  if ((pulseIn(xPin,HIGH) > 10) and (pulseIn(xPin,HIGH) < 5000))
  { digitalWrite(red_led,HIGH); }
  else
  {digitalWrite(red_led,LOW);}
  
  if ((pulseIn(yPin,HIGH) > 1000) and (pulseIn(yPin,HIGH) < 1200))
  { digitalWrite(blue_led,HIGH); }
  else
  {digitalWrite(blue_led,LOW);}
}