# Acceleration Curve

We used an acceleration curve to overcome the sensitivity of the low range of the joystick. The code looks exactly like this:

``````tempRight = pwm13 = pwm14 = Limit_Mix(2000 + p1_y + p1_x - 127);
tempLeft = pwm15 = pwm16 = Limit_Mix(2000 + p1_y - p1_x + 127);

if(p1_y >= 127){
tempRight = (tempRight - 127)(tempRight - 127)/127 + 127;
tempLeft = (tempLeft - 127)(tempLeft - 127)/127 + 127;
}
if(p1_y < 127){
tempRight = (tempRight - 127)(tempRight - 127)/-127 + 127;
tempLeft = (tempLeft - 127)(tempLeft - 127)/-127 + 127;
}

pwm13 = pwm14 = tempRight;
pwm15 = pwm16 = tempLeft;
``````

When building, the compiler gives error 1202: Call of non-function, on the 4 lines inside the if statements.

I’m completely stumped, any help would be greatly appreciated.

I’m not entirely sure what the error is in your code i will take a look at it again but if u want here is the method i used for doind the same thing u are doing:

try adding brackets for order of operations:
tempRight = (((tempRight - 127) * (tempRight - 127))/127) + 127;

You need an asterisk (*) to multiply.

Thats the one!

'Doh! Man, 3 years programming C and I still make these stupid mistakes. Yesterday I forgot to end a quotation on a string and the compiler decided to give a syntax error on a comment 20 lines down :ahh:

Thanks alot for the help guys, it’s always nice to have the outside party take a look at your code because one of two things can happen:

1. They write it better.
2. They find your stupid mistake.
1. You can help them find their stupid mistakes. Stupid if statements