Quote:
Originally posted by Clark Gilbert
One thing for you to try after u get everything figured out is to have it so your robot can drive with 1 stick or 2. I know we had this last year, and to switch it to one stick all we did was move a switch on the operators panel. Not sure how we did it, but i thought it was pretty cool.
|
Some code for your viewing pleasure:
Quote:
if (p3_sw_aux1=1) then twoJoystick
oneJoystick:
PWM1 = (((2000 + p1_y - p1_x + 127) Min 2000 Max 2254) - 2000)
PWM2 = (((2000 + p1_y + p1_x - 127) Min 2000 Max 2254) - 2000)
goto endDrive
twoJoysticks:
PWM1=p1_y
PWM2=p2_y
endDrive:
|
With this code, whenever port 3 aux1 is pressed, you will drive with two joysticks, but when it isn't pressed, you only need one. Port 3 aux1 could be anything you want it to be, but most often it would be a switch of some sort on your "button box."