Go to Post If you do mentor FIRST, be an asset to your team, but know that your students will admire you all the more if you set an example and finish your own homework. - Eugenia Gabrielov [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
  #19   Spotlight this post!  
Unread 21-02-2003, 21:26
ttedrow's Avatar
ttedrow ttedrow is offline
Herding electrons
AKA: Tim Tedrow
FRC #0281 (EnTech)
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2000
Location: Greenville, SC
Posts: 165
ttedrow will become famous soon enoughttedrow will become famous soon enough
For those of you that may still be struggling with autonomous code, here is some code snippets that may help.


loopCnt VAR byte 'Loop counter Low byte
loopCntHigh VAR nib 'Loop counter High nibble

StradegyNumber VAR nib 'The Stradegy number selected on robot

Stradegy1 VAR rc_swB.bit5 ' Stradegy Selection Switch 1
Stradegy2 VAR rc_swB.bit6 ' Stradegy Selection Switch 2
Stradegy3 VAR rc_swB.bit7 ' Stradegy Selection Switch 3

loopCnt=0
loopCntHigh=0

MainLoop:

'>>>>>>>>>>>>>>>>>>> LOOP COUNTER <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
IF auton_mode THEN
IF (loopCnt + 1 > 255) THEN
loopCntHigh = loopCntHigh + 1
loopCnt = 0
ELSE
loopCnt = loopCnt + 1
ENDIF
ELSE
loopCnt = 0
loopCntHigh = 0
ENDIF

'>>>>>>>>>> STRADIGY SELECTION <<<<<<<<<<<<<<<<<<<<<<
'This section move the stradegy switches into the StradegyNumber varible for program use
StradegyNumber.Bit0 = Stradegy1
StradegyNumber.Bit1 = Stradegy2
StradegyNumber.Bit2 = Stradegy3

'>>>>>>>>>> AUTONOMOUS MODE <<<<<<<<<<<<<<<<<<<<<
IF auton_mode THEN 'Check for Autonomous mode
SELECT StradegyNumber
CASE 0
'Stradegy 0 code goes here
CASE 1
'Stradegy 1 code goes here
CASE 2
'Stradegy 2 code goes here
CASE 3
'Stradegy 3 code goes here
CASE 4
'Stradegy 4 code goes here
CASE ELSE 'Not a valid stradegy
PWM1 = 127
PWM2 = 127
ENDSELECT 'End the autonomous mode stradegy selection
ELSE 'Not in Autonomous Mode
loopCnt=0 'Reset Loop Counter when not in Autonomous Mode
loopCntHigh=0
ENDIF


Tim Tedrow
__________________
Sr. Design Engineer
Caterpillar Inc.
Greenville, SC

KD4EGM

FRC 281 Greenvillains
Infected with the FIRST virus in 2000

Yes, Chute Door!!!
 


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
2-week FIRST summer program @ WPI ColleenShaver General Forum 20 31-05-2009 03:02
Fried program slots? Jeff Waegelin Programming 18 19-03-2003 18:08
Ahh! Program trick confusing! archiver 2001 9 24-06-2002 02:26
Credits for FIRST program. archiver 2000 6 24-06-2002 00:16
An invitation for HS Juniors archiver 2000 0 23-06-2002 22:51


All times are GMT -5. The time now is 20:06.

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