Robotics Asked by Stackcode12 on December 15, 2020
//ERROR: Task ‘autonomous’ is not defined at global scope level
#pragma config(StandardModel, "RVW CLAWBOT")
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#pragma DebuggerWindows("joystickSimple")
task autonomous();
task main()
{
while (true)
{
// update buttons and joysticks
getJoystickSettings(joystick);
//Assign the left and right joystick values
//to the left and right motors
motor[leftMotor] = joystick.joy1_y1;
motor[rightMotor] = joystick.joy1_y1;
task autonomous()
{
motor[leftMotor] = 80;
motor[rightMotor] = 80;
wait1Msec(2500);
motor[leftMotor] = 0;
motor[rightMotor] = 0;
wait1Msec(1000);
motor[leftMotor] = 80;
motor[rightMotor] = -80;
wait1Msec(2500);
motor[leftMotor] = 0;
motor[rightMotor] = 0;
}
if(motor[rightMotor] == 1) {
startTask(autonomous);
stopTask(main);
}
}
}
The code for “task autonomous()” should be outside of the main() function.
Answered by SteveO on December 15, 2020
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP