I'm starting to experiment with the joy_rot/raw values, and I tried the example in the manual for keeping the throttle within a 0-100 range. Mathematically, it's perfect, but I can't seem to get it to work.
Here's the
Code:
#include <acknex.h>
#include <default.c>
fixed throttle;
PANEL* _joydiag=
{
digits(512,364,"joyX= %1.0f",_a4font,1,joy_raw.x);
digits(512,384,"joyY= %1.0f",_a4font,1,joy_raw.y);
digits(512,404,"throttle= %1.0f",_a4font,1,throttle);
flags= VISIBLE;
}
void main()
{
video_mode= 8;
video_screen= 1;
screen_color.red= 1;
wait(3);
while(1)
{
throttle= 50 - (50 / 255) * joy_raw.z;
wait(1);
}
}
As you can see, it's a
very simple test program that merely shows the values of the joystick axes. I don't understand why the red part is showing 50 instead of what the actual value should be.
Could it be an error elsewhere?