Log in

View Full Version : Joystick Programming


team 803
19-02-2006, 15:50
In the file where it shows the joystick controls, I have tried different arrangements so that one joystick will control all of the wheels, but the program lines that it had devoted to this in the file does not work.
I need it so that when lean the joystick left the right wheels go forward while the left go back and Vice-versa, can anybody give me a code that will do this.

I have tried to make one myself, but they don't work.

team 803
19-02-2006, 15:55
pwm01 = p1_y;
pwm02 = p2_y;
pwm03 = p3_y;
pwm04 = p4_y;
pwm05 = p1_x;
pwm06 = p2_x;
pwm07 = p3_x;
pwm08 = p4_x;


01 will be the right while 02 will be the left, how do I set that up so that one will reverse while the other goes forward (as described above)?

Mike AA
19-02-2006, 16:12
copied from innovation first's 2006 default programming

pwm13 = pwm14 = Limit_Mix(2000 + p1_y + p1_x - 127);
pwm15 = pwm16 = Limit_Mix(2000 + p1_y - p1_x + 127);


If you dont want to use 13,14,15,16 change 13,14 to 01 and 15,16 to 02 and


//pwm01 = p1_y;
//pwm02 = p2_y;
pwm03 = p3_y;
pwm04 = p4_y;
pwm05 = p1_x;
pwm06 = p2_x;
pwm07 = p3_x;
pwm08 = p4_x;
pwm09 = p1_wheel;
pwm10 = p2_wheel;
pwm11 = p3_wheel;
pwm12 = p4_wheel;


That should map the joystick movement to one stick drive.

-Mike

Hieb
19-02-2006, 16:17
If you are using the default code and want 1 joystick drive, make sure your right motors are in pwm13/pwm14 and that your left motors are in pwm15/pwm16.

team 803
21-02-2006, 07:54
One detail I forgot, the left motors are connected through one wire and the same with the right.

Jake M
21-02-2006, 11:33
That's perfectly fine. You don't need to use both 13 and 14, or both 15 and 16. Just one or the other. 13 and 14 are exactly the same, as are 15 and 16.

team 803
21-02-2006, 11:49
We are using the second stick for the launcher, I am not quite sure how to set that up (two weeks experience with programming). We need it so that when the top button is pressed, the motor starts. (I think that would be aux)
pwm 04
Then when the stick is pressed forward it moves the other motor forward and when moved backwards it goes backwards.
pwm 05