|
Re: Programming a Joystick
Quote:
Originally Posted by EOC
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."
|