Go to Post Seriously, when I grow up (or if I grow up) I want to be just like Al. - Paul Copioli [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #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.
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
26 variable limit Gusman1188 Programming 9 12-02-2003 22:38
Coupling the Chiaphua & a variable Drill output Jeff Sharpe Motors 9 13-01-2003 20:21
Variable Amperage in DC Circuit. How? Jordan A. Electrical 4 01-11-2002 20:26
Dashboard programs and the char variable Ian W. Programming 13 26-06-2002 02:07
what teams have a variable transmissions? Greg Perkins Technical Discussion 4 06-03-2002 06:10


All times are GMT -5. The time now is 04:23.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi