Pages: [1]   Go Down
Author Topic: Accelerometer and Servo control  (Read 318 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 0
Posts: 192
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24371
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

Pages: [1]   Go Up
Jump to: