My program is having a problem compiling is there any one who can help me fix this?

int main() {

// Initializing Robot Configuration. DO NOT REMOVE!

vexcodeInit();

//Drive Control

//Set the left and right motor to spin forward using the controller Axis values as the velocity value.

FrontLeft.spin(vex::directionType::fwd, Controller1.Axis3.value(), vex::velocityUnits::pct);

FrontRight.spin(vex::directionType::fwd, Controller1.Axis2.value(), vex::velocityUnits::pct);

Lift.spin(vex::directionType::fwd, Controller1.ButtonL1.value(), vex::velocityUnits::pct);

Lift.spin(vex::directionType::fwd, Controller1.ButtonL2.value(), vex::velocityUnits::pct);

}
The error that I am getting when I compile it is “No member named ‘value’ in ‘vex Controller::button’”

Is this your complete program? Usually there is a bit more boilerplate in main.cpp.

What’s the exact compilation error you’re getting?

The exact error I am getting is

No member named ‘value’ in ‘vex Controller::button

That means exactly what is says.
You probably want to be using “pressing()”

see this.

https://api.vexcode.cloud/v5/html/classvex_1_1controller_1_1button.html

but your code is going to need to be enclosed in a “while” loop as well.

6 Likes