I need help finding whats wrong with the code, I plan to have R1 make the lift go up and L1 make the lift go down. I’m also planning to have our left motor for driving be one stick and our our right motor for driving be the other stick.
// ---- START VEXCODE CONFIGURED DEVICES ----
// Robot Configuration:
// [Name] [Type] [Port(s)]
// leftmotor motor 1
// rightmotor motor 2
// Controller1 controller
// leftlift motor 3
// rightlift motor 8
// ---- END VEXCODE CONFIGURED DEVICES ----
#include “vex.h”
using namespace vex;
int main() {
// Initializing Robot Configuration. DO NOT REMOVE!
vexcodeInit();
void usercontrol(void) {
//Lift Up
if(Controller1.ButtonR1.pressing()){
leftlift.spin(forward);
rightlift.spin(forward);
}
//Lift Down
if(Controller1.ButtonL1.pressing()){
leftlift.spin(reverse);
rightlift.spin(reverse);
}
//Joystick Forward
leftmotor.spin(forward, Controller1.Axis3.position(), pct);
rightmotor.spin(forward, Controller1.Axis2.position(), pct);
So I should end int main before I code the controller? I thought that int main started everything, and then usercontrol was the programming of the controller, is that right?
Usercontrol is for everything during driver control, but this is only when you are using the competition template. If you aren’t using the competition template then remove ‘void usercontrol(){‘ and its corresponding brackets.
And just so you know, you can’t define a function inside of a function, so that code wouldn’t compile anyway.