UNOFFICIAL: Autonomous code not working...

@Sarah B
Your issue appears to be a lack of semicolons. Every command should end in a semicolon. Logic (if statements, while loops, etc.) and preprocessor directives (anything preceded by a hash #) do not end in a semicolon. Basically, semicolons tell the compiler where a command ends. Also, you should have a set of parentheses around your while loop condition and a set of curly braces { }after it, around the code.

while(1==1) {

#pragma config(Motor, port1, leftDrive2, tmotorVex393, openLoop)
#pragma config(Motor, port2, leftDrive1, tmotorVex393, openLoop, reversed)
#pragma config(Motor, port3, rightPull, tmotorVex393, openLoop)
#pragma config(Motor, port4, leftElevation, tmotorVex393, openLoop)
#pragma config(Motor, port5, rightDrive2, tmotorVex393, openLoop)
#pragma config(Motor, port6, conveyorBelt, tmotorVex393, openLoop)
#pragma config(Motor, port7, ballShooter, tmotorVex393HighSpeed, openLoop)
#pragma config(Motor, port8, leftPull, tmotorVex393, openLoop)
#pragma config(Motor, port9, rightElevation, tmotorVex393, openLoop)
#pragma config(Motor, port10, rightDrive1, tmotorVex393HighSpeed, openLoop, reversed)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

//Competition Control and Duration Settings
#pragma competitionControl(Competition)
#pragma autonomousDuration(20)
#pragma userControlDuration(120)

#include "Vex_Competition_Includes.c" //Main competition background  not modify!

// 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;

// All activities that occur before the competition starts
// Example: clearing encoders, setting servo positions, ...

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

task autonomous()
//drive forward to goal and then use conveyor belt to release 4 balls
//drive forward

While (1==1) {

motor[leftDrive1] = 127;
motor[leftDrive2] = 127;
motor[rightDrive1] = 127;
motor[rightDrive2] = 127;
motor[leftDrive1] = 0;
motor[leftDrive2] = 0;
motor[rightDrive1] = 0;
motor[rightDrive2] = 0;

//release balls in conveyor belt
motor[port7] = 127;
motor[port7] = 0;



When you set motor values, you basically assign a value to a member of a built-in array, which then translates to power sent to the motor. Variable assignments always need to end in a semicolon.
Also, your while loop did not have curly braces { }. Without curly braces, any logical statement (while, if, etc.) only applies to the command immediately following it, until a semicolon is found. Thus, the above code without the curly braces inside it would basically do this:

while(1==1) {
motor[leftDrive] = 127;

Only the left drive motor would run, but none of the other code would ever be reached because the while loop is infinite.

EDIT: Samuel Crouch beat me to the punch by a few minutes, but I didn’t see his thread until after I posted this. Disregard this if he answered your questions fully.

The semicolons missing would only cause warnings, not errors. The problem was the braces

Missing semicolons resulted in errors because they pushed commands together. The compiler thought the code looked like this:

motor[leftDrive]=127motor[rightDrive]=127 and so on.

All commands must be processed separately, separated by semicolons. The compiler knows that variables must be preceded by a semicolon (end of previous line, value is assigned to the variable), or an operator of some kind (=, +, -, +=, etc.) (value of variable is included in operation).

Also, you can do this:

motor[leftDrive] = 127;

It would only run the command motor[leftDrive] = 127;
It’s not a great practice generally, but our programming team uses it occasionally, along with an extra indent.
We do this sometimes:


but with different names, of course.

Thank you so much everyone. This has been a huge help!