Thread: variable?
View Single Post
  #7   Spotlight this post!  
Unread 28-03-2003, 11:01
Greg Ross's Avatar
Greg Ross Greg Ross is offline
Grammar Curmudgeon
AKA: gwross
FRC #0330 (Beach 'Bots)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Hermosa Beach, CA
Posts: 2,245
Greg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond repute
Send a message via AIM to Greg Ross Send a message via Yahoo to Greg Ross
Quote:
Originally posted by Mark McLeod
(BTW: This was indented for readability when I typed it in)
Mark,

To preserve indentation, put your code inside {code}...{/code} vBcode tags. (Replace the curly braces with square brackets.)

Here's your code with them:
Code:
'----------Put these in your declaration section
'These are the # of program loops that completes the movement
FIRST_LEG    CON 40    '~ 1 second assuming delta_t=0
SECOND_LEG   CON 200   '~5.2 seconds
THIRD_LEG    CON 250   '~6.5 seconds
'The last leg you define here should not be > 577 (15 sec.)

auto_counter      VAR    WORD

'------------Put this before your main loop
auto_counter = 0

'-----------Put this immediately after your Serin command
' We are just overriding the joystick values as if the driver were
' moving the joystick

IF auto_mode = 0 then NoAuto
   auto_counter = auto_counter + 1
   'Can also do: auto_counter = auto_counter + 1 + delta_t

   If auto_counter >= FIRST_LEG then LEG2
      'These values should be what your driver would normally do
      'with the joystick to accomplish what you want to do
      p1_x = 254    
      p1_y = 0
      Goto NoAuto

LEG2:   
   If auto_counter >= SECOND_LEG then LEG3
      p1_x = 254
      p1_y = 0
      Goto NoAuto

LEG3:
   If auto_counter >= THIRD_LEG then NoAuto
      'Make sure you come to a stop as the last LEG
      p1_x = 127
      p1_y = 127
      Goto NoAuto

NoAuto:

'------------The rest of your regular code
__________________
Greg Ross (The Grammar Curmudgeon formerly known as gwross)
S/W Engineer, Team 330, the Beach 'Bots
<--The Grammar Curmudgeon loves this cartoon.
“Life should not be a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming "Wow! What a Ride!" Hunter S. Thompson
"Playing a practical joke means doing something mean and calling it funny." Me

Last edited by Greg Ross : 28-03-2003 at 11:07.