View Single Post
  #1   Spotlight this post!  
Unread 26-01-2006, 14:38
sacr3denigma sacr3denigma is offline
Registered User
None #0280
 
Join Date: Jan 2006
Location: Taylor
Posts: 1
sacr3denigma is an unknown quantity at this point
Need help with our deadspace.

This is what we are using for our deadspace. Only problem with it is that it jumps from being 127 to say 142 without slowly getting up to speed. We would like to make this much smooth. I am fairly new at robot language but have c++ experience if that helps any. Please reply if you can help thankyou.
temp2 = (unsigned int)p2_y;

if (temp2 > (127 + DEADSPACE))
{
pwm02 = 255 - (unsigned char)(((temp2 - (127 + DEADSPACE)) * (127 / (127 - DEADSPACE))) + 127);
}
else if (temp2 < (127 - DEADSPACE))
{
pwm02 = 255 - (unsigned char)(temp2 * 127 / (127 - DEADSPACE));
}
else
{
pwm02 = 127;
}