Go Down

Topic: Accelerometer and Servo control (Read 459 times) previous topic - next topic

njkl44

Alright if i have an accelerometer at default position i want a servo to be at the middle most point (90 degrees if 180 degree rotation). When i move the accelerometer to the left i want the servo to fallow to movement, so when the accelerometer is at -90 degrees the servo is at -90 degrees. Same as if one is at -45 degrees the other one is the same. My question is how would i code this. i have looked at accelerometer code but am just unsure of how to control the servo the way i stated. Also would a gyroscope do a better job of this?

Thank You, Easton

AWOL

Quote
so when the accelerometer is at -90 degrees the servo is at -90 degrees

-90 degrees relative to what?

Remember, an accelerometer only measure acceleration, so only your acceleration is due to gravity, your movement will normally have an accleration pahase, and an equal and opposite decceleration phase.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Go Up