Pls help :D

Hello, guys, can anyone help write a program in ROBOTC for VEX Robotics4.x for vex iq slick, it must collect small debris but go around large objects. I’ll be very thankful.

1 Like

What in general do you need help with? Are you using Graphical?

Hi, I need a programm, I started making a program for avoiding obstacles using a gyro sensor
#pragma config(StandardModel, “Autopilot Robot”)
//!!Code automatically generated by ‘ROBOTC’ configuration wizard !!//

task main()
{
while(1)
{
while(getDistanceValue(distanceMM)>=200)
}
if((getDistanceValue(distanceMM)<200)&&(getDistanceValue(distanceMM)>=100))
{
stopAllMotors()
setMotorSpeed(leftMotor,-50);
setMotorSpeed(rightMotor,50);
wait(50);
stopAllMotors();
}
while(getDistanceValue(distanceMM)<200)
{
setMotorSpeed(leftMotor,-50);
setMotorSpeed(rightMotor,-50);
}
resetMotorEncoder(leftMotor);
while(getMotorEncoder(leftMotor) < 360 * (200 / PI * 63)))
{
setMultipleMotors(50, leftMotor, rightMotor);
}
resetGyro(GyroSensor);
while(getGyroDegrees(gyroSensor)<90)
{
setMotorSpeed(leftMotor,0);
setMotorSpeed(rightMotor,50);
}
but its wrong

Format your code by putting ``` before and after it.

Formatted Code
#pragma config(StandardModel, “Autopilot Robot”)
//!!Code automatically generated by ‘ROBOTC’ configuration wizard !!//

task main() {
  while (1) {
    while (getDistanceValue(distanceMM) >= 200)
  }
  if ((getDistanceValue(distanceMM) < 200) && (getDistanceValue(distanceMM) >= 100)) {
    stopAllMotors()
    setMotorSpeed(leftMotor, -50);
    setMotorSpeed(rightMotor, 50);
    wait(50);
    stopAllMotors();
  }
  while (getDistanceValue(distanceMM) < 200) {
    setMotorSpeed(leftMotor, -50);
    setMotorSpeed(rightMotor, -50);
  }
  resetMotorEncoder(leftMotor);
  while (getMotorEncoder(leftMotor) < 360 * (200 / PI * 63))) {
  setMultipleMotors(50, leftMotor, rightMotor);
}
resetGyro(GyroSensor);
while (getGyroDegrees(gyroSensor) < 90) {
  setMotorSpeed(leftMotor, 0);
  setMotorSpeed(rightMotor, 50);
}

What exactly is your problem?

3 Likes

Please don’t ask for people to code entire programs and just give them to you. We’re all about helping out, but don’t expect full solutions from anybody.

5 Likes