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.
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
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.