I’m trying to do the autonomous programming for the world championship, but when I want to run the program, it doesn’t do anything, it literally doesn’t move at all, so a little help doesn’t hurt TT
// ---- START VEXCODE CONFIGURED DEVICES ----
// Robot Configuration:
// [Name] [Type] [Port(s)]
// Controller1 controller
// Right motor_group 12, 11
// Left motor_group 14, 15
// Intaker motor 2
// Wings digital_out H
// InsuranceStop motor 13
// InsuranceActive digital_out G
// Elevation motor_group 10, 9
// ---- END VEXCODE CONFIGURED DEVICES ----
#include "vex.h"
using namespace vex;
void Go(){
Left.spin(reverse,80,percent);
Right.spin(forward,80,percent);
}
void back(){
Left.spin(forward,80,percent);
Right.spin(reverse,80,percent);
}
void TurnRight(){
Left.spin(reverse,80,percent);
Right.spin(reverse,80,percent);
}
void TurnLeft(){
Left.spin(forward,80,percent);
Right.spin(forward,80,percent);
}
void OneIntaker(){
Intaker.spin(forward,80,percent);
}
void WingsOpen(){
Wings.set(true);
}
void WingsClose(){
Wings.set(false);
}
void StopDriveTain(){
Right.stop();
Left.stop();
}
void stop(){
Right.stop();
Left.stop();
Intaker.stop();
Wings.set(false);
}
// A global instance of competition
competition Competition;
// define your global instances of motors and other devices here
/*---------------------------------------------------------------------------*/
/* Pre-Autonomous Functions */
/* */
/* You may want to perform some actions before the competition starts. */
/* Do them in the following function. You must return from this function */
/* or the autonomous and usercontrol tasks will not be started. This */
/* function is only called once after the V5 has been powered on and */
/* not every time that the robot is disabled. */
/*---------------------------------------------------------------------------*/
void pre_auton(void) {
// Initializing Robot Configuration. DO NOT REMOVE!
vexcodeInit();
Intaker.setVelocity(90,percent);
Right.setVelocity(92,percent);
Left.setVelocity(92,percent);
// 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. */
/*---------------------------------------------------------------------------*/
void autonomous(void) {
// ..........................................................................
// Insert autonomous user code here.
Brain.Screen.clearScreen();
Brain.Screen.print("autonomous code");
Brain.Timer.clear();
while(true){
while(Brain.Timer.time(seconds)>0 && Brain.Timer.time(seconds)<0.4){
TurnLeft();
}
while(Brain.Timer.time(seconds)>0.5 && Brain.Timer.time(seconds)<1){
StopDriveTain();
}
while(Brain.Timer.time(seconds)>0.8 && Brain.Timer.time(seconds)<1.1){
Go();
}
while(Brain.Timer.time(seconds)>0.7 && Brain.Timer.time(seconds)<1.1){
WingsOpen();
}
while(Brain.Timer.time(seconds)>0.8 && Brain.Timer.time(seconds)<1){
Go();
}
while(Brain.Timer.time(seconds)>1.2 && Brain.Timer.time(seconds)<1.8){
WingsClose();
}
while(Brain.Timer.time(seconds)>2.5 && Brain.Timer.time(seconds)<2.8){
StopDriveTain();
}
while(Brain.Timer.time(seconds)>2 && Brain.Timer.time(seconds)<2.3){
back();
}
while(Brain.Timer.time(seconds)>2.5 && Brain.Timer.time(seconds)<2.8){
TurnRight();
}
}
// ..........................................................................
}
/*---------------------------------------------------------------------------*/
/* */
/* 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. */
/*---------------------------------------------------------------------------*/
void usercontrol(void) {
// User control code here, inside the loop
while (1) {
//Tren motriz
Right.spin(forward,Controller1.Axis2.position(),percent);
Left.spin(forward,Controller1.Axis3.position(),percent);
Right.spin(reverse,Controller1.Axis2.position(),percent);
Left.spin(reverse,Controller1.Axis3.position(),percent);
//Intaker
if(Controller1.ButtonL1.pressing()==1){
Intaker.spin(forward);
}
else if(Controller1.ButtonL2.pressing()==1){
Intaker.spin(reverse);
}
else{
Intaker.stop(hold);
}
//Elevation
if(Controller1.ButtonR1.pressing()==1){
Elevation.spin(reverse);
}
else if(Controller1.ButtonR2.pressing()==1){
Elevation.spin(forward);
}
else{
Elevation.stop(hold);
}
//Seguro de la elevacion para que pare la elevcion
if(Controller1.ButtonA.pressing()==1){
InsuranceStop.spin(forward);
}
else{
InsuranceStop.stop(hold);
}
//Seguro para activar la elevacion
if (Controller1.ButtonB.pressing()==1) {
InsuranceActive.set(true);
}
//Alas de neumatica
if (Controller1.ButtonX.pressing()) {
Wings.set(true); // Open the solenoid
}
if (Controller1.ButtonY.pressing()) {
Wings.set(false); // Open the solenoid
}
// ........................................................................
// Insert user code here. This is where you use the joystick values to
// update your motors, etc.
// ........................................................................
wait(20, msec); // Sleep the task for a short amount of time to
// prevent wasted resources.
}
}
//
// Main will set up the competition functions and callbacks.
int main() {
// Set up callbacks for autonomous and driver control periods.
Competition.autonomous(autonomous);
Competition.drivercontrol(usercontrol);
// Run the pre-autonomous function.
pre_auton();
// Prevent main from exiting with an infinite loop.
while (true) {
wait(100, msec);
}
}