View Single Post
  #8   Spotlight this post!  
Unread 23-01-2012, 17:53
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 667
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: Help Needed with some Simple Programming

Oh, I forgot one thing. We defined our own ABS macro as well. So the macros should be:
Code:
#ifndef DEADBAND_INPUT_THRESHOLD
  #define DEADBAND_INPUT_THRESHOLD  0.10
#endif
#define ABS(n)                  (((n) < 0)? -(n): (n))
#define DEADBAND(n,t)           ((ABS(n) > (t))? (n): 0)
#define DEADBAND_INPUT(n)       DEADBAND(n, DEADBAND_INPUT_THRESHOLD)
 
 
float x = DEADBAND_INPUT(joystick.GetX());
float y = DEADBAND_INPUT(-joystick.GetY());
__________________
Reply With Quote