ROBOTC.net forums http://www.robotc.net/forums/ |
|
Noob code (need help with fixing error) http://www.robotc.net/forums/viewtopic.php?f=53&t=4796 |
Page 1 of 1 |
Author: | Flawededge [ Tue Sep 04, 2012 3:37 am ] |
Post subject: | Noob code (need help with fixing error) |
#pragma config(Motor, port2, frontRightMotor, tmotorServoContinuousRotation, openLoop) #pragma config(Motor, port3, backRightMotor, tmotorServoContinuousRotation, openLoop) #pragma config(Motor, port4, frontLeftMotor, tmotorServoContinuousRotation, openLoop) #pragma config(Motor, port5, backLeftMotor, tmotorServoContinuousRotation, openLoop) #pragma config(Motor, port6, middleMotor, tmotorServoContinuousRotation, openLoop) #pragma config(Motor, port7, SpinnyThing, tmotorServoContinuousRotation, openLoop) #pragma config(Motor, port8, QuadBelt1, tmotorServoContinuousRotation, openLoop) #pragma config(Motor, port9, QuadBelt2, tmotorServoContinuousRotation, openLoop) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*// task main() { while (1 == 1) { motor[backLeftMotor] = vexRT[Ch3]; motor[backRightMotor] = vexRT[Ch3]; motor[frontLeftMotor] = vexRT[Ch3]; motor[frontRightMotor] = vexRT[Ch3]; motor[middleMotor] = vexRT[Ch4]; motor[backLeftMotor] = vexRT[Ch1]; motor[frontLeftMotor] = vexRT[Ch1]; motor[backRightMotor] =- vexRT[Ch1]; motor[frontRightMotor] =- vexRT[Ch1]; } ------------ while(true) { if (vexRT[Btn7U] == 1) { motor[SpinnyThing] = 127; motor[QuadBelt1] = 127; motor[QuadBelt2] = 127; } else if (vexRT[Btn7D] == 1) { motor[SpinnyThing] =- 127; motor[QuadBelt1] =- 127; motor[QuadBelt2] =- 127; } else { motor[SpinnyThing] = 0; motor[QuadBelt1] = 0; motor[QuadBelt2] = 0; } } **Error**:Variable 'true' is subsequently used as a procedure **Error**:Ummatched left brace '{' **Error**:Expected->'}'. Found 'EOF' The top and bottom brace are giving errors =( Could someone tell me what to do, or any improvements that i could do to the code With the dashes, i'm kinda showing the break between the joystick and the buttons |
Author: | JohnWatson [ Tue Sep 04, 2012 9:40 am ] |
Post subject: | Re: Noob code (need help with fixing error) |
**Error**:Ummatched left brace '{' **Error**:Expected->'}'. Found 'EOF' These two are key. It's telling you that you are missing an end brace '}' somewhere in the code (meaning, there is an unmatched left brace, "{"). If we look through we see the while loop does not have a closing brace on it at all. If you put one in after the last else statement, it should work. |
Author: | jbflot [ Mon Oct 01, 2012 3:10 pm ] |
Post subject: | Re: Noob code (need help with fixing error) |
Check out the videos in the VEX Cortex Video Trainer > Fundamentals > Introduction to Programming: http://www.education.rec.ri.cmu.edu/pro ... index.html They go over why things like matching braces are important. The rest of the videos would also help give you a good programming background. |
Page 1 of 1 | All times are UTC - 5 hours [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |