yay855
Rookie
Joined: Wed Nov 28, 2012 3:57 pm Posts: 4
|
 Re: RobotC Autonomous Template Does not Recognize 'waitforst
sure thing, here you go.
The Code:
[spoiler]#pragma config(Hubs, S1, HTMotor, HTServo, none, none) #pragma config(Sensor, S2, touch, sensorNone) #pragma config(Sensor, S3, light, sensorNone) #pragma config(Sensor, S4, sonar, sensorNone) #pragma config(Motor, motorA, LEGOmtr, tmotorNXT, PIDControl, encoder) #pragma config(Motor, motorB, CLAW, tmotorNXT, PIDControl, encoder) #pragma config(Motor, motorC, , tmotorNXT, openLoop) #pragma config(Motor, mtr_S1_C1_1, rightmotor, tmotorTetrix, openLoop, reversed) #pragma config(Motor, mtr_S1_C1_2, leftmotor, tmotorTetrix, openLoop) #pragma config(Servo, srvo_S1_C2_1, bottemarm, tServoStandard) #pragma config(Servo, srvo_S1_C2_2, toparm, tServoStandard) #pragma config(Servo, srvo_S1_C2_3, servo3, tServoNone) #pragma config(Servo, srvo_S1_C2_4, servo4, tServoNone) #pragma config(Servo, srvo_S1_C2_5, servo5, tServoNone) #pragma config(Servo, srvo_S1_C2_6, servo6, tServoNone) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#include "JoystickDriver.c"
task main() {
//waitForStart(); // Wait for the beginning of autonomous phase.
while (true) { //CONTROLS THE DRIVING //,...........,............,...........,....................................................................................// int threshold = 6; /* Int 'threshold' will allow us to ignore low */ /* readings that keep our robot in perpetual motion. */ while(true) // Infinite loop: { getJoystickSettings(joystick); if(abs(joystick.joy1_y2) > threshold) // If the right analog stick's Y-axis readings are either above or below the threshold: { motor[motorE] = (0.5*joystick.joy1_y2); // Motor D is assigned a power level equal to the right analog stick's Y-axis reading. } else // Else if the readings are within the threshold: { motor[motorE] = -0; // Motor D is stopped with a power level of 0. } if(abs(joystick.joy1_y1) > threshold) // If the left analog stick's Y-axis readings are either above or below the threshold: { motor[motorD] = (0.5*joystick.joy1_y1); // Motor E is assigned a power level equal to the left analog stick's Y-axis reading. } else // Else if the readings are within the threshold: { motor[motorD] = -0; // Motor E is stopped with a power level of 0. } //...................................................................................................................................................// //BUTTONS TO CONTROL CLAW if(joy1Btn(1))// { motor[motorB]= -75;//If Button 3 is pressed:"x button" blue } if(joy1Btn(3)) // If Button 3 is pressed:"B button" red { motor[motorB]= 75 ; } if(joystick.joy1_TopHat == 2) { motor[motorB] = -0; // stop } //.............................................................................................................................................// // BUTTONS TO CONTOL BOTTEM SERVO ARM // Control arm via shoulder buttons, 5 and 6... 5=up, 6=down 7 = extreme down button 8=extreme up/ in
if(joy1Btn(5)) // If Button 5 is pressed: { servo[servo1] = 225;// Raise Servo 1 to position 225.down } if(joy1Btn(6)) // If Button 6 is pressed: { servo[servo1] = 125; // Lower Servo 1 to position 125.up } if(joy1Btn(7)) // If Button -- is pressed: { servo[servo1] = 250; // Raise Servo 1 to position 250 } if(joy1Btn(8)) // If Button -- is pressed: { servo[servo1] = 20; // Raise Servo 1 to position 20.in } //...............................................................................................................................................// // CONTROLS TOP SERVO ARM if(joy1Btn(2)) // If Button 2 is pressed:"A button" green { servo[servo2] = 15; // Lower Servo 1 to position down and in. } if(joy1Btn(4)) // If Button 1 is pressed:"Y button" yellow { servo[servo2] = 135; //Raise Servo 1 to position up. //..............................................................................................................................................// // controls for whatever lego motor// } if(joystick.joy1_TopHat == 0) { motor[motorA] = +75; //forward } if(joystick.joy1_TopHat == 4) { motor[motorA] = -75; // backwards } if(joystick.joy1_TopHat == 6) { motor[motorA] = -0; // stop //............................................................................................................................ }// matches last left bracket to end that funtion.\\you can place more code after it }//ends while statement.\\you can place another statement to continue building on your task main }// ends task main.\\you cannot write more code after this right bracket } [/spoiler]
and the error message is this:
[spoiler]**Info***:Undefined procedure 'waitForStart'. Global subroutine assumed. **Error**:Undefined procedure 'waitForStart'[/spoiler]
|