I have a Lilypad Arduino ATmega 328 and a Lilypad Accelrometer ADXL335.

I have used the example code to retrieve input values from the ADXL335 and that seems to be working fine. When the ADXL335 is flat and stationary I am getting values around 512 for x and y, and 612 for z.

As a simple experiment, I am trying to get individual LEDs to light up depending on the tilt of the ADXL335. I decided to start with the x axis. When I tilt the ADXL335 away from me I get minimum values of about 370 and when I tilt it towards me I get maximum values of about 640.

The hardware is setup as follows:xpin = A3ypin = A2zpin = A1+ to + on lilypad- to - on lilypadxforward LED to 6xbackward LED to 7

I have written some code in an attempt to get xforward to light up when I tilt the ADXL335 towards me and x backwards to light up when I title the ADXL355 away from me. However I am failing. To test my connection I wrote an else statement to get the lights to blink. The lights just blink all the time, regardless of my xpin readings.

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

// 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.

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

// 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.