Code for adxl to control

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.

Also, how would you go about adding the signals from two axis (ie sum up the values from the x axis and y axis, and have a servo respond to that new number)

thanks for the help

Hi BrandonV,

Welcome to the RobotShop Forum. The output of the ADXL 335 is an analog signal between 0 and Vmax while a servo motor needs a recurring signal / pulse every ~20ms. This means you need to have a microcontroller as intermediary. You did not specify which microcontroller you were using (are you using a compiler on your PC directly?). Given the input value of the accelerometer, you simply use a bit of math to convert that to a recurring signal to the servo. Are you planning to use the servos to visually display the acceleration value?