View Single Post
  #4   Spotlight this post!  
Unread 21-02-2007, 12:42
tdlrali tdlrali is offline
Registered User
FRC #0469 (Las Guerrillas)
Team Role: Programmer
 
Join Date: Sep 2006
Rookie Year: 2006
Location: MI
Posts: 377
tdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud of
Re: Inverting x-axis

Please use 255, not 254.
If you use 254, and your joystick goes to max in one direction (255), you would get -1. Since the joystick input is an unsigned char, the value will "wrap around", making it 255 again.

If you were trying to go left, it would suddenly go full power to the right.

So:
Code:
inverted = 255 - normal;

Last edited by tdlrali : 21-02-2007 at 12:45.
Reply With Quote