Gyro auto

This is the question about hot to use gyro in Robot c in auto mode, i used the easyc v5 to try it before , but it seems that easy c cant do that i try out to use the robot c, but it seems too new for me.i ll appreciate that if u can help me.
i want to know how to write a program like this.this is the plan here.e.g.
1.go forward with port[1,2,9,10] motors for 2sec
3.lift the arm with port [3,4,5] motors for 1 sec
4.put it down and stop
5.left turn 90 degrees with gyro
7.go forward 1sec
9.right turn 90 degrees with gyro

Do you mind telling us the problem you faced. Is it something wrong with the Gyro Sensor in general? Or is it only in Autonomous mode?

Only in the auto mode
The problem I am facing is that don’t know how to write a program to make the robot follow the plan which i made. As i m not sure about when shd i initial the gyro sensor, start the gyro or get the values . So that i cant write a programme which follows the plan i made.i ll appreciate that if i can get a full example of the program,which follows the plan.thanks.

First off, good job taking the leap to sensors! You will be able to say you made a robot and mean it, because its not a robot unless it can sense and respond.

In robotC, go file > open sample program > gyroscope > Gyro Based Turns - Best.c

That file has the code you are looking for and good comments to help you understand the code. The program is not in the competition template, so resets the gyro in task main. For the competition, you will want to move those first lines of sample program task main() into your competition template void pre_auton().

Good luck!

I appreciate that, I tried that out before, that sample really helps me to understand the use of the gyroscope, but i still can’t understand how to write a program,which can fulfill my plan.i can’t write a program that can fulfill my plan when it comes to a whole autonomous program,not only one thing of gyro,it’s about a whole plan.
My poor English ,Hope you understand

Writing out the steps in plain language is a good start. You can put that in the program as comments, then write the actual code in the same order. I have written a few of your steps some adapted code from the basic gyro sample program.

	//1.go forward with port[1,2,9,10] motors for 2sec
	motor[port1] = 100;
	motor[port2] = 100;
	motor[port9] = 100;
	motor[port10] = 100;
	wait1Msec(2000); // wait 2 seconds
	motor[port1] = 0;
	motor[port2] = 0;
	motor[port9] = 0;
	motor[port10] = 0;
	//3.lift the arm with port [3,4,5] motors for 1 sec
	//4.put it down and stop
	//5.left turn 90 degrees with gyro
	//While the absolute value of the gyro is less than the desired rotation - 100...
	while(abs(SensorValue[gyro]) < 800)
		//...Continue turning
		motor[rightMotor] = 70;
		motor[leftMotor] = -70;
	//Brief brake to eliminate some drift
	motor[rightMotor] = -5;
	motor[leftMotor] = 5;

	//Second while loop to move more slowly toward the goal
	while(abs(SensorValue[gyro]) < 900)
		//...Continue turning, slowly
		motor[rightMotor] = 30;
		motor[leftMotor] = -30;
	motor[rightMotor] = 0;
	motor[leftMotor] = 0;

	//7.go forward 1sec
	//9.right turn 90 degrees with gyro

You will need to name your gyro “gyro” or replace that name in the code, and replace motor[rightMotor] with the two motors on the right side, and same for left side. Hopefully you can see how to write the remaining steps.

Thanks, let me try it out.

Isn’t making it respond to your movements on the controller during driving control considered “making the robot sense and respond” the movements your fingers make to make the robot move?

No. A robot acts without human intervention based on sensor data. An ROV is controlled in real time by a remote human operator.

Ok i tried an another way out, I successfully use easy c v5 to write a program with gyro, to fulfill my plan. It made me half of a day to figure it out.