|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#5
|
||||
|
||||
|
Re: gyro c++ Programing
A simple way, not necessarily the best way, is to do the following:
Code:
float targetAngle = gyro.GetAngle() + 45.0;
while (gyro.GetAngle() < targetAngle)
{
//
// Turn the robot to the right at half speed.
//
myRobot.ArcadeDrive(0.0, 0.5);
}
//
// Go straight at half speed.
//
myRobot.ArcadeDrive(0.5, 0.0);
Wait(3.0);
//
// Stop.
//
myRobot.ArcadeDrive(0.0, 0.0);
|
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|