Whenever I compile this bit of code, it compiles correctly but then gives me a ton of warnings. Is this ok/will it still work?
void driveforward( void ) {
int degrees;
int DriveMotorSpeed;
LeftMotor.startRotateFor(degrees,rotationUnits::raw,DriveMotorSpeed,velocityUnits::pct);
LeftMotor2.rotateFor(degrees,rotationUnits::raw, DriveMotorSpeed,velocityUnits::pct);
RightMotor.rotateFor(degrees,rotationUnits::raw,-DriveMotorSpeed,velocityUnits::pct);
LeftMotor.rotateFor(degrees,rotationUnits::raw,-DriveMotorSpeed,velocityUnits::pct);
}
what are the warnings ? just unused variables or something like that ?
well you have these two variables and use them
int degrees;
int DriveMotorSpeed;
but you never assigned number to them
293X
5
Put the variables Drive Motor Speed and degrees in the parameter such that when you create the callback statement, they will be defined.
I think you just answered your own question.
like this
void driveforward( int degrees, int DriveMotorSpeed ) {
LeftMotor.startRotateFor(degrees,rotationUnits::raw,DriveMotorSpeed,velocityUnits::pct);
LeftMotor2.rotateFor(degrees,rotationUnits::raw, DriveMotorSpeed,velocityUnits::pct);
RightMotor.rotateFor(degrees,rotationUnits::raw,-DriveMotorSpeed,velocityUnits::pct);
LeftMotor.rotateFor(degrees,rotationUnits::raw,-DriveMotorSpeed,velocityUnits::pct);
}
then call from somewhere else
driveforward( 90, 50 );
293X
9
@jpearman
7517j asked the question.
ok thx @7517H and @jpearman