Taking in the input as p1_y, and output as pwn01... I'm having some problems.
When the joystick is moved the the direction of "128 - 254" it works, yet when "126 - 0" it starts of to work (motor turning) but then full blast turns the other direction. I do not understand what might be the problem. The Code worked fine in the RoboEmu.
Here is a part of the code
Code:
if (p1_y > 127) // This part works
{
pwm01 = (0.007874015748031496062992125984252) * (p1_y - 127) * (p1_y - 127) + 127;
}
else // Does not work
{
pwm01 = (-0.007874015748031496062992125984252) * (p1_y - 127) * (p1_y - 127) + 127;
}
The only differenece it that the 2nd part has " (-0.00787..."
a negative number.
Is that the Problem? If not, what am I doing wrong?