View Single Post
  #1   Spotlight this post!  
Unread 31-01-2008, 00:55
divergentdave divergentdave is offline
Registered User
FRC #1816 (Green Machine)
 
Join Date: Jun 2006
Rookie Year: 2007
Location: MN
Posts: 35
divergentdave is a jewel in the roughdivergentdave is a jewel in the roughdivergentdave is a jewel in the rough
Send a message via AIM to divergentdave
Re: 1 Joystick Control

Quote:
Originally Posted by usbcd36 View Post
...Simplest way to do that is subtract the value you assign to the PWM outputs from 254:
Actually you should subtract from 255 in this case. (if Limit_Mix returns you a 255, then pwm13=254-255=-1, but the -1 wraps over the unsigned char to 255, whereas if you subtract from 255, then you will correctly get 0) So, that line should read
Code:
pwm13 = pwm14 = 255 - Limit_Mix(2000 + p1_y + p1_x - 127);
__________________
Team 1816 - The Green Machine