Subject:
|
Re: IC loop
|
Newsgroups:
|
lugnet.robotics.handyboard
|
Date:
|
Thu, 23 Jan 1997 04:34:10 GMT
|
Original-From:
|
Fred G. Martin <fredm@media.*AntiSpam*mit.edu>
|
Viewed:
|
1184 times
|
| |
| |
Hi Wade,
You can use the "seconds()" function which reports elapsed time, plus
a variable to keep track of when the loop should end:
void main() {
float end_time;
end_time= seconds() + 20.; /* go for 20 seconds */
while (seconds() < end_time) {
/* body of the loop goes here */
}
}
Good luck,
Fred
In your message you said:
> Hope someone can help,
>
> I have just written my first code for my bot. All I have done so far is
> make my bot go forward in about a 4 foot square area. I am now wanting to
> put a loop in the code so that it will continue for a certain length of time
> or count. I think I should probably use the while expression but I am not
> sure how to do this. Can anyone help me out. I am just beginning to pick
> up on the IC code so I may be asking a really dumb sounding question but I
> guess that is how you learn. I would appreciate anyones help.
>
> Thanks in Advance,
> Bill Rose
> Fort Smith, AR
>
>
|
|
Message is in Reply To:
| | IC loop
|
| Hope someone can help, I have just written my first code for my bot. All I have done so far is make my bot go forward in about a 4 foot square area. I am now wanting to put a loop in the code so that it will continue for a certain length of time or (...) (28 years ago, 23-Jan-97, to lugnet.robotics.handyboard)
|
3 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|