My team has recently started using the V5 distance sensor on our robot, the code we have is supposed to be stopping the robot when it gets close to the goal, the problem is that it doesn’t seem to be working. The robot continues to drive forward and the distance sensor measurements are correct.
Here is the code:
//lma = leftMotorA and rma = rightMotorA and so on
motor_group Drive(lma, lmb, lmc, rma, rmb, rmc);
Drive.spin(fwd);
if(distanceSensor.objectDistance(mm)< 15){
Drive.stop();
}```