Go to Post (If Dean still says 'Nationals', how can you ridicule a rookie team for it? Come on.) - Amanda Morrison [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 Rating: Thread Rating: 9 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #13   Spotlight this post!  
Unread 08-05-2014, 22:14
yash101 yash101 is offline
Curiosity | I have too much of it!
AKA: null
no team
 
Join Date: Oct 2012
Rookie Year: 2012
Location: devnull
Posts: 1,191
yash101 is an unknown quantity at this point
Re: How to loop peices of code forever?

When I program in VEX, RobotC, I create a main loop. This loop will execute until it is killed somehow, or the break statement is used. Basically, you have an infinite loop (while(true) {...}) and that holds all your code.

In this loop, you only execute the command ONCE. Basically, the program loop will constantly check all inputs. If it notices any of the inputs high, for example, using a joystick, the program branches into another function, that runs the mechanism once. For servos, this is different. You assign a servo a position and it will stay there. You only signal the servo when you change positions (or not).

This way, everything will run together constantly.

It is sad that the VEX cortex does not support threading or tasks . It would be nice to run tasks parallel to each other. Does anyone by chance know how to bypass RobotC and actually access C10 (I think that's what it runs)? We are doing VEX robotics in eng. class, but I want to do things that are a bit harder!
 


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


All times are GMT -5. The time now is 22:05.

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