|
Re: Will camera keep running if i have a while statement going
you cannot use while or for loops in the RC code.
The main loop of the code does something like this:
1. read all the sensor and OI inputs (including the camera)
2. execute all your code
3. update all the output (to the motors and servos...)
goto 1
as you can see, a while loop in step 2 will hold up the entire program, and stop any further inputs or outputs
to make matters worse, there is another processor in the RC that you do not have access to. If it sees the code is not updating the outputs at the normal rate it assumes your code has gone out to lunch, and it shuts the robot down.
you need to use IF statements to check and see if the condition you are looking for is true. If not then let the code continue, and it will check again on its next loop through.
|