So I’ve had a previous post about the gyro and I got it to work but now I’m having trouble with it clearing itself. For example if I told the robot to turn 90 degrees but then I wanted it to turn another 90 it wouldn’t turn because it had already reached 90 degrees in the previous turn. If anybody could give me information on this problem and the gyro in general that’d be great.
Wouldn’t it just move to 180 degrees then? If I am not mistaken, once the gyro is initialized, the position of 0 is a constant.
At least, that’s how it used to be with RobotC.
Are you using VCS?
you can reset the value of the gyro after your turn
SensorValue[Gyro] = 0;
or you can add the number of degrees you want to turn to the current gyro value at the start of your turn function to find the target gyro value
gyro_target = SensorValue[Gyro] + turn_amount;
hope this helps
Thanks for the help but I don’t know how to convert this over to VCS, because isn’t that robotc?
That’s my bad for not telling you that I was using VCS, my bad.
sorry cant help with VCS, I switched to pros last year
You can use something like this in VCS C++
float gyro_target = (Gyro.value() + degrees);