Quote:
|
Originally Posted by willie837
I have a single joystick code for my robot, but I don't want it to do anything when i tilt the joystick left and right.
|
A single joystick with no left/right action will give you only one axis of control. At first glance, it looks like you're asking for a robot which will only go forward and backward, and never turn. The easiest way to do that is to replace every occurrence of
p1_x in the
user_routines.c file with the constant
127.
But that can't be what you want. Are you perhaps asking how to keep the robot from turning in place when you aren't also moving forward or backward? That's conceptually easy, and I could probably change the code myself to do it in about 30 seconds, but it's not easy to describe to a novice programmer. Try changing every occurrence of
p1_x to the following:
Code:
(((p1_y<137)&&(p1_y>117))?127:p1_x)
Basically, this keeps the x-axis value at neutral when the y-axis value is within 10 of neutral.