![]() |
Turning problems in Vex autonomous. [Solved]
I wrote the following code using easyC for Vex.
It's a function, it's supposed to take the angle I give it and turn in that direction. If I give it a positive angle, it turns to the right. I'm trying to make it turn to the left if I give it a negative angle, but it ain't happening. For some reason it simply turns to the right again. Any ideas? Code:
#include "Main.h" |
Re: Turning problems in Vex autonomous.
Code:
if ( angle > 0 & angle <= 90 )Personally, I always write multiple expressions in the following form. It is more readable and forces the precedence I want. I have to type a few more keystrokes but it is worth the correctness and clarity. Code:
if ( (angle > 0) && (angle <= 90) ) |
Re: Turning problems in Vex autonomous.
Since the wheels are mounted on opposite sides of the robot, they need to be operated opposite from each other. For example: To drive straight you would use:
SetMotor ( L_MOTOR , 255 ) ; SetMotor ( R_MOTOR , 0 ) ; Try swapping the SetMotor ( R_MOTOR , 255 ) ; and SetMotor ( R_MOTOR , 0 ) ; calls. |
Re: Turning problems in Vex autonomous.
Thanks, Keith. It works great now.
koenig3456: But I want the robot to turn... ;-) |
| All times are GMT -5. The time now is 03:21. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi