|
Strange but...need fresh eyes
We've been trying to figure this one out for a couple of days. Here is the code in question:
p1_y = (unsigned char) (((double) p1_y + (double)127)*.75);
if (p1_y > 250)
{
p1_y = (unsigned char)250;
}
PrintToScreen ("P1_y is %d\n", (int)p1_y);
The first line is a conversion we need to use to make our steering wheel paddles work. p1_y is the value sent to the drive motors. What is happening is the wheels spin forward until the upper limit (250) at which point they immediately spin backwards or stop. Output from the print line reflects this condition, increasing to 250 then converting to 1 or 127. We thought maybe the steering wheel had started to send the wrong signal at its limit, but changing the limit set point (i.e. from 250 down to 245) results in the same thing. Any ideas?
|