gyro turning


#1

hello! i have a question on how to make my robot turn left using the gyro. i have the code to make it turn right using the gyro but im having trouble making it turn the other way .
here is my code im using robotc

task main()
{
//Completely clear out any previous sensor readings by setting the port to “sensorNone”
SensorType[in8] = sensorNone;
wait1Msec(1000);
//Reconfigure Analog Port 8 as a Gyro sensor and allow time for ROBOTC to calibrate it
SensorType[in8] = sensorGyro;
wait1Msec(2000);

//Adjust SensorScale to correct the scaling for your gyro
//SensorScale[in8] = 260;
//Adjust SensorFullCount to set the “rollover” point. A value of 3600 sets the rollover point to +/-3600
//SensorFullCount[in8] = 3600;

//Specify the number of degrees for the robot to turn (1 degree = 10, or 900 = 90 degrees)
//change degrees 10 = 1 degree
int degrees10 = 900;

//While the absolute value of the gyro is less than the desired rotation…
while(abs(SensorValue[in8]) < degrees10)
{
//…continue turning
motor[rightMotor] = 50;
motor[leftMotor] = -50;
}

//Brief brake to stop some drift
motor[rightMotor] = -5;
motor[leftMotor] = 5;
wait1Msec(250);
stopMotor(leftMotor);
stopMotor(rightMotor);
}


#2

I’m just reposting your question here but adding the code tags to make it a little easier to read.
Now that I’ve looked at it, what exactly is happening? Is it turning too much, too little, or does it not move at all?


#3

thank you for helping but i have figured it out. i just needed to add the other motors on the other side of the bot so it can turn the other way.