View Full Version : Reversing the joystick axis
JBotAlan
09-02-2005, 19:22
Sorry if I didn't search well enough, but how does one go about reversing the joystick value? I tried a negative, but I realized the pwm value is an unsigned val, what is the math I need to do on the joystick value to make it so foreward is backward and backward is foreward?
Tristan Lall
09-02-2005, 19:34
#DEFINE PWM_MAX 254
...
pwm01 = PWM_MAX - p1_y //Your joystick 1 y-value is reversed
Sorry if I didn't search well enough, but how does one go about reversing the joystick value? I tried a negative, but I realized the pwm value is an unsigned val, what is the math I need to do on the joystick value to make it so foreward is backward and backward is foreward?
Instead of:
pwm01=p1_x;
do:
pwm01=255-p1_x;
Good luck.
Instead of:
pwm01=p1_x;
do:
pwm01=255-p1_x;
Good luck.
Yeah, this worked for us
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.