I have some questions.if you could answer i would be glad.In your code,

void A2Ddata(unsigned int n) {

long tempG = 0, tempX = 0, tempY = 0, tempZ = 0;

for(unsigned int k = 1; k <= n; k++){

tempG += analogRead(gPin);

}

gRaw = tempG*10/n; ????

}

???? what the value you get ? is it radians/sec or deg/sec ? is tempG given you as raw value of the sensor ?

especially i didnt understand the temG*10/n ? what this calc. do?

A2Ddata(

; ???? why did you send 8 ?

//Calculate gyro turn rate

rate = (gRaw*Vin/100-gOffset)*0.0150; ??

if (abs(rate) > 2.5) {

angle += (rateold+rate)*0.010; //trapz intergration ???

}

rateold = rate;

?? what this rate means ?

??? this should be the integration to calculate angle.

// code to reduce gyro drift under steady conditions

if (rate < 5) {

if (rate > 0) {

gOffset++;

}

else{

gOffset--;

}

}

Did you use this in your code?

I am sorry about these question, it is a lot. But really i need these because i am at the end of edge my thesis. Thanks your help