Hi all,
OK, I've been looking at Kevin's gyro code, and have been trying to work out an algorithm to maintain a certain heading using the gyro supplied in the kit.
My thoughts are leaning towards something like this:
Code:
Reset_Gyro_Angle();
if(Get_Gyro_Angle > 10){//1 degree
turn left
}
else if(Get_Gyro_Angle < -10){//-1 degree
turn right
}
else
stop
Am I correct about the gyro values, where a positive value would be a turn to the right and a negative value would be a turn to the left?
And would this code (without optimizations) allow self adjustment to a certain heading (despite oscillations)?
Thanks,