how to detect up down and left right rotation of Adxl335 accelerometer

hi. I am new to work with arduino uno and Analog Adxl335 accelerometer. i am developing an application to detect accelerometer [up down and left right] tilt. please can you help me

Front-Back tilt is called "Pitch".
Left-Right tilt is called "Roll".

This tutorial explains how to measure them:
http://physics.rutgers.edu/~aatish/teach/srr/workshop3.pdf

There are lots of other examples. Google will let you find lots of other examples.

how can i put all together this code into arduino, bcz it is step by step. and a code given in processing language is not working well. and nothing is shown when i run it in processing software.

const int XPin = A0;
const int YPin = A1;
const int ZPin = A2;

// Zero offsets: Average of max and min values
const int XZero = 512;
const int YZero = 512;
const int ZZero = 512;

void setup() {Serial.begin(19200);}
void loop() {
    long XAcc = analogRead(XPin) - XZero;
    long YAcc = analogRead(YPin) - YZero;
    long ZAcc = analogRead(ZPin) - ZZero;

    // apply trigonometry to get the pitch and roll:
    float pitch = atan(xAcc/sqrt(YAcc*YAcc + ZAcc*ZAcc)); 
    float roll = atan(YAcc/sqrt(XAcc* XAcc + ZAcc* ZAcc)); 

    // Print the values (in Radians)
    Serial.print(pitch); Serial.print(","); Serial.println(roll);

    delay(1000);
}

sir, how can i connect 2 ADXL335 accelerometers with arduino, because i want to detect human activities such as, sitting standing and walking. Any one can help me

@wasieem_Bari: please don't report your own post to the moderators.

There is an important distinction that is being missed here.

The ADXL335 detects linear acceleration along the x, y and z axis.

It does not detect angular acceleration. For that, you want one of the MEMS sensors described as a “gyro”, or a “6-axis” device (the 6 axes being x, y, z, and roll, pitch, yaw).

Depending on what you’re sensing, one or the other may be more appropriate.

To connect another '335, you just need to use three different analog pins. This uses up analog pins mighty fast - there exist I2C and SPI accelerometers that may be better if you need lots of them (but many I2C ones only let you have one of 2 addresses, which is less useful)