Go to Post First off, let me suggest that you read the rules! There is an amazing amount of really good information in them. - dlavery [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

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 14-01-2003, 14:50
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 frumious

if counter++ > 500 then 'arbitrary time value
p1_x = 254
else
p1_x = 0
endif
Yeah, that will work as long as you ditch the ++ part. Doing a little C recently?


Anyway, dead-reckoning with the 2.5 syntax begs you to use the SELECT:
Code:
counter var word
counter=0

do
serin ....

IF auton_mode = 1 then
  SELECT counter
    CASE 0 to 100
      PWM1=254
      PWM2=254
      counter=counter+1
    CASE 101 to 200
      PWM1=254 
      PWM2=0
      counter=counter+1
    CASE else
      PWM1=127
      PWM2=127
   ENDSELECT
ELSE 
   'regular code goes here
ENDIF

serout...
LOOP
This code will go forward for approx. 2.6 seconds, then turn for another 2.6. To add new steps, just add another CASE. After it's done, it just stops and no longer incremements the counter. If you put the counter incrementer outside the SELECT, it will loop back to 0 after approx. 28 minutes. This may be OK, it may not.
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php
Closed Thread


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
autonomous mode problem on field Chris_C Programming 17 26-03-2003 19:11
Autonomous Code From Experience EbonySeraphim Programming 7 14-03-2003 21:56
Autonomous code tutorial miketwalker Programming 2 23-02-2003 12:28
Overcomplicated Autonomous Code EbonySeraphim Programming 33 20-02-2003 21:53
Autonomous Code Adrian Wong Robotics Education and Curriculum 1 18-11-2002 22:34


All times are GMT -5. The time now is 09: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