Hey all, newbie programmer here looking for some help with my autonomous code. At the moment I need to be able to turn 90 on the spot using a gyro stop and drive straight also using a gyro and encoder for distance.
Code:
public void autonomous() {
while(isAutonomous() && isEnabled()) {
SmartDashboard.putNumber("angle", gyro1.getAngle());
double angle = gyro1.getAngle();
robot.drive(-0.20, 1);
if(angle > 83) {
robot.drive(0,0);
break;
The issue I have is the robot won't stop turning

. I need a basic tutorial on setting up an encoder for distance. Also if anyone could show me how I could start driving straight after this turn, Thanks for the help.