Hey guys, I’m trying to make some code that will cause my right motor to move when my left motor moves for a certain sensor value, but when I run it, it doesn’t do anything. Could anyone give me some help? Thank you.
indent preformatted text by 4 spaces
#include “robot-config.h”
void baseSensor(int LeftValue, int velocity )
{
RearLeft.setStopping(brakeType::coast);
RearRight.setStopping(brakeType::coast);
RearLeft.resetRotation();
RearRight.resetRotation();
RearLeft.rotateFor(LeftValue,rotationUnits::deg,velocity,velocityUnits::pct);
while(RearLeft.isSpinning())
{
RearRight.spin(directionType::fwd,velocity,velocityUnits::rpm);
}
// RearRight.startRotateFor(RightValue,rotationUnits::deg,velocity,velocityUnits::pct);
task::sleep(30);
}
int main() {
baseSensor(1000, 100);
}