I’ve been writing some code for a competition next week, and I can’t figure out how to write this common function in C++. Here is the code in Robot C.
#pragma config(Motor, port1, leftFront, tmotorVex393_HBridge, openLoop)
#pragma config(Motor, port2, leftBack, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port3, rightFront, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port4, rightBack, tmotorVex393_MC29, openLoop, reversed)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
void baseControl(int leftSpeed, int rightSpeed, int time)
{
motor[leftFront] = leftSpeed;
motor[leftBack] = leftSpeed;
motor[rightFront] = rightSpeed;
motor[rightBack] = rightSpeed;
time = wait1Msec(time);
}
task main()
{
baseControl(127, 127, 1000);
}
Basically, it makes each drive train rotate for a certain amount of power for a certain amount of time. Thanks for the help as always.