Also,
Code:
...
pwm01 = (-0.007874015748031496062992125984252) * (p1_y - 127) * (p1_y - 127) + 127;...
You will notice that
Code:
...
((p1_y - 127) * (p1_y - 127) + 127) / 127
...
will work much much better for your purposes. Since pwm01 is an unsigned char and the whole thing will be converted to a char later, it does not matter that you are doing integer division.
Sometimes you have to forget the lessons you're taught so well in Comp Sci.
