I don’t know why my code won’t take input from my controller. The screen and brain work fine, and I can put text on the screen, but I can’t get the controller to work. I use VS code and recently got rid of extensions like PROS and lemlib because I suck. I don’t know if that would impact the controller though.
/*----------------------------------------------------------------------------*/
/* */
/* Module: main.cpp */
/* Author: Seiji Garcia */
/* Created: 11/14/2025, 8:48:39 AM */
/* Description: V5 project */
/* */
/*----------------------------------------------------------------------------*/
#include "vex.h"
using namespace vex;
// A global instance of competition
competition Competition;
// define your global instances of motors and other devices here
controller controller1 = controller(controllerType::partner);
brain Brain;
//motors
motor leftFrontMotor = motor(PORT1);
motor leftMiddleMotor = motor(PORT2);
motor leftBackMotor = motor(PORT3);
motor rightFrontMotor = motor(PORT4);
motor rightMiddleMotor = motor(PORT5);
motor rightBackMotor = motor(PORT6);
motor_group leftSide = motor_group(leftFrontMotor, leftMiddleMotor, leftBackMotor);
motor_group rightSide = motor_group(rightFrontMotor, rightMiddleMotor, rightBackMotor);
motor intake = motor(PORT7);
//pneumatics
digital_out pistons1 = digital_out(Brain.ThreeWirePort.A);
digital_out pistons2 = digital_out(Brain.ThreeWirePort.B);
digital_out piston3 = digital_out(Brain.ThreeWirePort.C);
/*---------------------------------------------------------------------------*/
/* 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) {
// 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.
// ..........................................................................
}
/*---------------------------------------------------------------------------*/
/* */
/* 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) {
// This is the main execution loop for the user control program.
// Each time through the loop your program should update motor + servo
// values based on feedback from the joysticks.
// ........................................................................
Brain.Screen.print(1);
//OH SO THIS WORKS FINE?!?!?!
//drive train
leftSide.spin(forward, (controller1.Axis3.position(percent) + controller1.Axis1.position(percent)) * 12/100, volt);
rightSide.spin(forward, (controller1.Axis3.position(percent) - controller1.Axis1.position(percent)) * 12 / 100, volt);
// ........................................................................
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);
}
}