Re: Sonar Sensor while loop
You want a loop in the program that loops for a pre-defined number of times? One of many ways is to use a "for" loop, like this:
The equivalent with a "while" would be:
Set you can replace "LOOPS" with either a constant or a variable, and it defines how many times to loop.
int is only 16 bits (IIRC ROBOTC doesn't support unsigned, so the limit is about 32 thousand), so you might need to use long which is 32 bits (where the limit is about 2 billion) for variable "i" (the counter).