We are making turn functions for our autonomous.
The robot wont turn, but instead, drive forward when we just copy and paste the inside of the code into the auton.
Also, when we call the function, it says error, and that it doesn’t know what it means.
//new "ninety degree right turn" function made.
leftMotor1.spin(forward);
leftMotor2.spin(forward);
rightMotor1.spin(reverse);
rightMotor2.spin(reverse);
//the robot is spinning right
waitUntil((Inertial8.rotation(degrees)>-90.0));
//the robot will spin until the inertial sensor calculates 90 degrees
leftMotor1.stop();
leftMotor2.stop();
rightMotor1.stop();
rightMotor2.stop();
//once that 90 degree point is taken, the motors should stop
}```
if your robot is driving straight forward then you might not have your right motors reversed in the motor configuration.
Also you need to reset the inertial sensor at the beginning of your function. You can do that with Inertial8.resetRotation(); You also need to change the waitUntil((Inertial8.rotation(degrees) > -90.0)); to waitUntil((Inertial8.rotation(degrees) < 90.0));