View Single Post
  #4   Spotlight this post!  
Unread 10-02-2007, 15:59
paulcd2000's Avatar
paulcd2000 paulcd2000 is offline
Accidentally speaks in C
AKA: Paul Dagnelie
FRC #1719 (The Umbrella Corp.)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Baltimore
Posts: 368
paulcd2000 is a jewel in the roughpaulcd2000 is a jewel in the roughpaulcd2000 is a jewel in the rough
Send a message via AIM to paulcd2000
Re: Programming a Joystick

Quote:
Originally Posted by EOC View Post
This setup is a bit twitchy, because slight movements in the joystick gets responses from the motor.
you can write a function to cancel out values near the middle range. we call ours, "DEADZONE":
Code:
unsigned char Deadzone(unsigned char x){
	if ( (x <= (127 + DEADZONE)) && (x >= (127 - DEADZONE)) ) // if variable is within DEADZONE, stop motor 
		return STOP;
	else
		return x;
}
you need to #define deadzone as something, around 15-20
just implement it:
Code:
p1_y = Deadzone(p1_y);
  p1_x = Deadzone(p1_x);
  p2_y = Deadzone(p2_y);
  p2_x = Deadzone(p2_x);
  p3_y = Deadzone(p3_y);
__________________
"People don't say 'It's just a game' when their team is winning!" -- Scott Adams

5.5 students (on average)* $7/h *210 hours/student= $8085 of labor, all volunteered (not counting mentors', who are each that much)

We have blades on our robot?! ***sweeeeeet***

There are 11 types of people in the world. Those who can read binary, those who can't, and those who say this joke is supposed to be, "There are 10 types of people in the world. Those who can read binary and those who have a life."