View unanswered posts | View active topics It is currently Thu Sep 18, 2014 10:40 am






Reply to topic  [ 3 posts ] 
Noob code (need help with fixing error) 
Author Message
Rookie

Joined: Wed Aug 22, 2012 11:39 pm
Posts: 1
Post 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


Tue Sep 04, 2012 3:37 am
Profile
Site Admin
Site Admin

Joined: Thu May 24, 2012 12:15 pm
Posts: 576
Post 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.

_________________
Check out our Blog! And our Facebook page!
Need help? Take a look at our Wiki and our Forums.

I just met you,
And this is crazy,
But here's my code now,
So fix it, maybe?
~ Carly Rae Jepsen parody


Tue Sep 04, 2012 9:40 am
Profile
Site Admin
Site Admin

Joined: Tue May 15, 2007 9:02 am
Posts: 405
Post 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.

_________________
Jesse Flot
CMU Robotics Academy
ROBOTC Support


Mon Oct 01, 2012 3:10 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 0 guests


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

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.