|
Page 1 of 1
|
[ 2 posts ] |
|
Motor Errors in RobotC programing
| Author |
Message |
|
roboticubs
Rookie
Joined: Wed Jan 23, 2013 10:55 am Posts: 3
|
 Motor Errors in RobotC programing
I am trying to create a program for autonomous and manual control mode and I keep having the following errors: **Error**:Undefined variable 'motorA'. 'short' assumed. **Error**:Undefined variable 'motorB'. 'short' assumed. **Error**:Undefined variable 'leftMotor'. 'short' assumed. **Error**:Undefined variable 'rightMotor'. 'short' assumed.
Here is my code below: #pragma platform(VEX)
//Competition Control and Duration Settings #pragma competitionControl(Competition) #pragma autonomousDuration(20) #pragma userControlDuration(120)
#include "Vex_Competition_Includes.c" //Main competition background code...do 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() { motor[motorA] = 100; //motor A is run at a 100 power level motor[motorB] = 100; //motor A is run at a 100 power level wait1Msec(4000); //the program waits 4000 milliseconds before running further code
motor[motorA] = -100; //motor A is run at a 100 power level motor[motorB] = -100; //motor A is run at a 100 power level wait1Msec(4000); //the program waits 4000 milliseconds before running further code }
///////////////////////////////////////////////////////////////////////////////////////// // // 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. // /////////////////////////////////////////////////////////////////////////////////////////
task usercontrol() {
while(true) { motor[leftMotor] = vexRT[Ch3]; // Left Joystick Y value motor[rightMotor] = vexRT[Ch2]; // Right Joystick Y value
if( vexRT[Ch3] == 1) { motor[leftMotor] = 100; } if(vexRT[Ch2] == 100) { motor[rightMotor] = 1; }
} }
-Thank you
|
| Mon Feb 11, 2013 10:41 am |
|
 |
|
JohnWatson
Site Admin
Joined: Thu May 24, 2012 12:15 pm Posts: 380
|
 Re: Motor Errors in RobotC programing
This question was answered in this thread: viewtopic.php?f=63&t=5483&p=22797#p22797 ; the issue was that none of the motors were assigned aliases (names) and that the program was using NXT motors (motorA, motorB, etc) in a VEX competition template. In the future, please refrain from posting the same question multiple times as it divides the conversation and can cause confusion. Thank you!
_________________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
|
| Mon Feb 18, 2013 11:00 am |
|
|
|
Page 1 of 1
|
[ 2 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 2 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
|
|