If anyone can help it would be much appreciated
As with any programming question, can you post your code?
2 Likes
LFmotor.spin(forward);
LBmotor.spin(forward);
RFmotor.spin(forward);
RBmotor.spin(forward);
waitUntil((Inertial.rotation(degrees) >= 45.0));
LFmotor.stop();
LBmotor.stop();
RFmotor.stop();
RBmotor.stop();
wait(10, msec);
After the RBmotor.spin(forward); command, place a Brain.Screen.print(intertial.rotation(degrees); Your code should look like this:
LFmotor.spin(forward);
LBmotor.spin(forward);
RFmotor.spin(forward);
RBmotor.spin(forward);
Brain.Screen.print(Intertial.rotation(degrees));
waitUntil(Intertial.rotation(degrees) >= 45.0);
LFmotor.stop();
LBmotor.stop();
RFmotor.stop();
RBmotor.stop();
wait(10, msec);
The value on the screen would be your rotation in degrees. I have a feeling that it is reporting negative values. Which way is the robot rotating?
2 Likes
ok thanks I’ll try this
it is rotating counter clockwise btw
If its rotating counterclockwise you could just set the wait until function to be less than or equal to -45.0 degrees, like this:
waitUntil(Intertial.rotation(degrees) <= 45.0);
3 Likes