|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Running Once?
Where can I put my code so that it will execute itself completely only one time. So, if I turn the bot off and on, it will run again. There was a section in the UserRoutines.c FUNCTION NAME: User_Initialization that says it only runs once, but this doesn't seem like the right place for my code.
|
|
#2
|
|||||
|
|||||
|
Re: Running Once?
Make a function somewhere in user_routines.c, put your code in there, and call that function from User_Initialization.
At least if you are trying what I think you are trying to do. |
|
#3
|
||||
|
||||
|
Re: Running Once?
What is stopping the program from going down the program and calling it, then it hits it again later and runs it? Is this programming language run-by-call-only and not run down the program. Right now I went into the users initialization and just pasted in my code snipet after where it says */Add you own...*/. Looks kind of messy, but only the robot will know
. |
|
#4
|
||||
|
||||
|
Re: Running Once?
Quote:
At least it's supposed to... ![]() |
|
#5
|
||||
|
||||
|
Re: Running Once?
Once I call my function, does the function need to link back to the user initialization part just before it left off. I am assuming that it will automatically go back to right after where it was called upon completetion.
|
|
#6
|
||||
|
||||
|
Re: Running Once?
Quote:
(If you didn't put in a return than the compiler will insert one for you at the end of the functions definition) |
|
#7
|
|||
|
|||
|
Re: Running Once?
There is a simpler way of having something only run once...
Code:
int counter = 0;
if (counter == 0)
{
do whatever you want once;
counter++;
}
|
|
#8
|
||||||
|
||||||
|
Re: Running Once?
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Kitbot/cims/transmissions running too slow? | Swampdude | Technical Discussion | 28 | 23-01-2005 11:17 |
| Running OSX 10.3 on a Macintosh Centris | Joe Matt | Chit-Chat | 4 | 27-10-2004 00:37 |
| Dual sites on home server running apache? | Mike AA | IT / Communications | 7 | 28-08-2004 02:02 |
| A vampire running for office | MissInformation | Chit-Chat | 2 | 30-08-2003 14:36 |
| The WebCam is Up and running | archiver | 2001 | 0 | 23-06-2002 23:08 |