acceleration derivates from speed, that derivates from position.
So dx/dt=v and dv/dt=a
then a=d²x/dt² (or x'')

continous fonctions are the limit of discrete thing when T -> infinity, so better results with higher frequency, and try to find a way to do your calculation as regularly as possible (gpio interrupts with a counter that triggers it ? or linux gives things similar .. ?).

whith discrete data, I think you should do something like :
v(i) = (x(i) - x(i-1)) / (t(i) - t(i-1))
and a(i) = (v(i) - v(i-1)) / (t(i) - t(i-1))

Tell me I'm wrong somewhere !

On 4/26/06, Demetris Zavorotnichenko <fgcity4652@cytanet.com.cy> wrote:
I have a gyro connected to the microcontroller.

I get Raw analog data from the gyro.

the Zero state is 50

if the gyro is turned to one side the value goes down

if gyro turns to the other side the value goes up

How do i calculate the speed of the turn?

I actually want to make a simple code of direction with the gyro. So when i
turn the device left i don't get the acceleration value but the position
substantial to previus position.

How do i do this?

-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier