Let's Make Robots!

accelerometer and servo code trouble

trying to use an accelerometer to control two servos, here is the code I have...

but this code for some reason just causes both servos to sweep constantly back and forth, with what seems like no regard to the position of the accelerometer?

thanks fellas





 The circuit:

 analog 1: z-axis

 analog 2: y-axis

 analog 3: x-axis

 analog 4: ground

 analog 5: vcc

 digital 9: servo_s

 digital 10: servo_p



If - then statements

Good Evening, 

I am trying to define a value (Y') based on an initial value (Y)...


Y' Calculations


If Y = 326, then 326 = Y'


If Y < 326, then ((326-Y)+326)=Y'


Accelerometer code

Hey guys, 

looking to control two servos (standard futuba hobby servos) from a adxl 335.

I have all the mechanical and electrical systems ready im just trying to figure out the code.

I have seen how to use the accelerometer to measure acc and just print to the serial on my pc, but how do i get those signals to control the position of a servo.