Driver control backwards error

Hello there,
I’m new to code in C++ and Vexcode Pro. And I’m having a problem with code. I’m writing the user control part. I can write it to move forward but when I try to write it in backwards it gives error that “called object type ‘double’ is not a function or funcion pointer”. I’m not entirely sure with how to use axis aswell. I’m going to post the code below. Thanks already for support and answers.

double wSpeed = 1.0;
bool wDirec = 1;

if (wDirec)
rightDt.spin(directionType::fwd, console.Axis3.position()*wSpeed , percentUnits::pct);
leftDt.spin(directionType::fwd, console.Axis2.position()*wSpeed , percentUnits::pct);
rightDt.spin(directionType::fwd, console.Axis2.position()*wSpeed(-1) , percentUnits::pct);
leftDt.spin(directionType::fwd, console.Axis3.position()*wSpeed(-1) , percentUnits::pct);

You can not do this, not sure where you got that idea from. To negate wSpeed just put - in front.

1 Like

for reversing, instead of wSpeed(-1) do -wSpeed so that it would look like

leftDt.spin(fwd, Axis3.position * -wSpeed, pct);

trying to do wSpeed(-1) is unquestionably the part throwing the error, that simply isn’t a thing you can do.

I think I had already answered this, no need to post the same solution.

1 Like

Oh shoot you’re right. Sorry!

says to self: WOW you are blind