Refreshing myself memory on functions

Hi guys, I’m trying to do more with my old functions ideas I use to teacher my old kids, and integrate a smart drive into it, I’m getting red marks on this, can someone point me in the right direction?

competition Competition;

motor_group LeftSide(LeftFront, LeftBack);

motor_group RightSide(RightFront, RightBack);

motor_group ArmsGo(ArmLeft, ArmRight);

smartdrive robotDrive(LeftSide, RightSide, Inertial12, 12.56, 16, 16, distanceUnits::in);

void drivingF(int distance, int speed, int direction) {

robotDrive.driveFor(distance, distanceUnits::in, speed, velocityUnits::pct, direction, directionType::fwd);


this is what I use to use for funtions:

void dforward(int distance, int speed) { //Drive Forward Left.rotateFor(-distance, rotationUnits::deg,speed,velocityUnits::pct,false); Lefter.rotateFor(-distance, rotationUnits::deg,speed,velocityUnits::pct,false); Right.rotateFor(distance, rotationUnits::deg,speed,velocityUnits::pct,false); Righter.rotateFor(distance, rotationUnits::deg,speed,velocityUnits::pct); }

When you specify the direction, you don’t do

Instead, it should be like this

void drivingF(int distance, int speed, directionType direction){
  robotDrive.driveFor(direction, distance, distanceUnits::in, speed, velocityUnits::pct);

The directionType goes first, and you don’t need an int for it. You can just pass in the directionType as a parameter. You can then call it like this

drivingF(15, 50, forward);

Here is the API docs if you want more info


Thank you, really appreciate that

Ok sorry last question I think, how bout for turns, I’m getting a red line for turnType, so not sure what I need to do:

void drivingT(int angle, int speed, int turn){

robotDrive.turnFor(turn, turnType::dir, angle, rotationUnits::deg);

Same as above, you have to do this

void drivingT(int angle, int speed, turnType turn){
  robotDrive.turnFor(turn, angle, deg);