View Single Post
  #8   Spotlight this post!  
Unread 08-11-2002, 18:35
rbayer's Avatar Unsung FIRST Hero
rbayer rbayer is offline
Blood, Sweat, and Code
no team (Teamless Orphan)
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Minnetonka, MN
Posts: 1,087
rbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of light
Send a message via AIM to rbayer
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."
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php