///////////////////////////////////////////////////////////////////////////////////////////// Pre-Autonomous Functions//// You may want to perform some actions before the competition starts. Do them in the// following function.///////////////////////////////////////////////////////////////////////////////////////////

void pre_auton(){// Set bStopTasksBetweenModes to false if you want to keep user created tasks running between// Autonomous and Tele-Op modes. You will need to manage all user created tasks if set to false.bStopTasksBetweenModes = true;

///////////////////////////////////////////////////////////////////////////////////////////// Autonomous Task//// This task is used to control your robot during the autonomous phase of a VEX Competition.// You must modify the code to add your own robot specific commands here.///////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////// User Control Task//// This task is used to control your robot during the user control phase of a VEX Competition.// You must modify the code to add your own robot specific commands here.///////////////////////////////////////////////////////////////////////////////////////////

while (true){wait1Msec(1000); // Robot waits for 1000 milliseconds before executing program

if(SensorValue(sonarSensor) > 5 || SensorValue(sonarSensor) < 0) // Loop while robot's Ultrasonic sensor is further than 4 inches away from an object{ // || (or) it is '-1'. (-1 is the value returned when nothing is in it's visable range)motor[rightMotor] = 127; // Motor on port2 is run at half (63) power forwardmotor[leftMotor] = 127; // Motor on port3 is run at half (63) power forward

The problem lies with the fact that you are not using indentation in your file. You're missing a brace in your code and it's impossible to spot if you're not going to use indentiation.

I have fixed it for you, but from now on, use indentation. I have included a screenshot where you can find the option to format your whole file every now and again, so it'll always look good. I've also gone ahead and added the program with the missing brace.

///////////////////////////////////////////////////////////////////////////////////////////// Pre-Autonomous Functions//// You may want to perform some actions before the competition starts. Do them in the// following function.///////////////////////////////////////////////////////////////////////////////////////////

void pre_auton(){ // Set bStopTasksBetweenModes to false if you want to keep user created tasks running between // Autonomous and Tele-Op modes. You will need to manage all user created tasks if set to false. bStopTasksBetweenModes = true;

///////////////////////////////////////////////////////////////////////////////////////////// Autonomous Task//// This task is used to control your robot during the autonomous phase of a VEX Competition.// You must modify the code to add your own robot specific commands here.///////////////////////////////////////////////////////////////////////////////////////////

}}///////////////////////////////////////////////////////////////////////////////////////////// User Control Task//// This task is used to control your robot during the user control phase of a VEX Competition.// You must modify the code to add your own robot specific commands here.///////////////////////////////////////////////////////////////////////////////////////////

while (true) { wait1Msec(1000); // Robot waits for 1000 milliseconds before executing program

if(SensorValue(sonarSensor) > 5 || SensorValue(sonarSensor) < 0) // Loop while robot's Ultrasonic sensor is further than 4 inches away from an object { // || (or) it is '-1'. (-1 is the value returned when nothing is in it's visable range) motor[rightMotor] = 127; // Motor on port2 is run at half (63) power forward motor[leftMotor] = 127; // Motor on port3 is run at half (63) power forward

// Move forward at full power motor[leftMotor] = 127; // Motor on port1 is run at full (127) power forward motor[rightMotor] = 127; // Motor on port10 is run at full (127) power forward wait1Msec(2000);

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum