Re: Tasks on RobotC vs 2.31
Controlling the same motor from two tasks is a bad idea. Unless you add additional code in there, you are asking for issues.
If vexRT[Ch2] is 0, what do you suppose the value of the motor will be set to when it gets to that line in the main task? What do you think will happen to the motor when it is told to run at 50% in the other task a millisecond later, only to be told to run at whatever level vexRT[Ch2] is?
You need to rethink your program and try to look at it from the robot's perspective. Right now it's like having two people shouting at you, one in your right ear, one in your left ear and both are giving you different directions on where to go. Who are you going to listen to?
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page