Whie loop causing syntax error - can not figure out why

#include “UserAPI.h”

int distance = 1; // Furthest Distance
int Angle = 0; // The angle that distance was found
int Travel; // How far it will go
int dump; // Dumpoff for ultrasonic
int servospin = 0; // Incremented Sonar Initializer
int pastdist; // determine change in distance
int makefile = 255; // allows compile of HEX data

void main ( void )
{
StartUltrasonic ( 1 , 11 ) ; // Initialize Ultrasonic Sensor
dump = GetUltrasonic ( 1 , 11 ) ; // Gets first disance to set Dump
distance = dump // Sets distance for Re-Use
while ( servospin <= makefile )
{
SetServo ( 3 , servospin ) ;
dump = GetUltrasonic ( 1 , 11 ) ; // Get-Dump
distance = pastdist
if ( dump > distance ) // (Boolean Check)
{
distance = dump // Logic Statemen, Further away or not
}
if ( distance > pastdist ) // Determines if furtest distnce changed, to set new angle for the entire robot to turn when necessary
{
Angle = servospin
}
}
}

That is my code, it says syntax error on line 16, the one with the while loop. any ideas?

You are missing the semicolon on line 15. The Compiler (or preprocessor) thinks that lines 15 and 16 are on statement that has an error in its second half (the half that starts on line 16).

Blake
PS: You are missing a few other semicolons… Go ahead and fix them all in one shot.

You are missing a semicolon on line 15.

there are several missing semicolons in there.

Enjoy,

Ray Moore

Get Moose and Squirrel!

Thanks, that is kind of odd though, i used the easyC software. But its not thathard to fix. is there a better program to use to program these? RobotC is still beta

“Whie” loops always cause errors:D

Actually it isn’t odd. That’s they way C syntax is supposed to work. Use C long enough and you will eventually spot these easily.

Blake

Don’t call me a n00b at easyC(i am:D ) but my RobotC trial just expired so i decided to use easyC to do this project, how do you add the semi-colons? i can not edit the code.

On the right side of the screen it should be kinda split blocks on the left and code on the right click and then type it in. You may have to enable something I don’t remeber.

I think you do need to enable somehting because it will not let me edit it. If anyine knows how to enable this?I need to know ASAP.

Time is running short:D

If you are using EasyC, then one way to do it is this:

Format what you see so that the Flowchart is shown. The help files tell you how to do this.

In the flowchart, double-click the Icon that corresponds to the C statement that needs to be edited.

A window should pop open that will let you edit the C statement

Blake