Obstacle avoiding project help

Hi, I am using Tinkercad to simulate my project as shown in the image. Tinkercad does not have the actual battery pack i will be using.

const int trig = 12;
const int echo = 11;
const int leftForward = 2;
const int leftBackward = 3;
const int rightForward = 4;
const int rightBackward = 5;
 
int duration = 0;
int distance = 0;
 
void setup() 
{
  pinMode(trig , OUTPUT);
  pinMode(echo , INPUT);
  pinMode(leftForward , OUTPUT);
  pinMode(leftBackward , OUTPUT);
  pinMode(rightForward , OUTPUT);
  pinMode(rightBackward , OUTPUT);
  
  Serial.begin(9600);
 
}
 
void loop()
{
  digitalWrite(trig , HIGH);
  delayMicroseconds(1000);
  digitalWrite(trig , LOW);
 
 
  duration = pulseIn(echo , HIGH);
  distance = (duration/2) / 28.5 ;
  Serial.println(distance);
  
 
  if ( distance < 20 )
  {
    digitalWrite(leftForward , LOW);
    digitalWrite(leftBackward , HIGH);
    digitalWrite(rightForward , HIGH);
    digitalWrite(rightBackward , LOW);
    delay(100);
  }
  else
  {
    digitalWrite(leftForward , HIGH);
    digitalWrite(leftBackward , LOW);
    digitalWrite(rightForward , HIGH);
    digitalWrite(rightBackward , LOW);
  }
 
}

This is the code I am running for the simulation. The motors show -231RPM which i don't know if it is right. Could someone please correct me?

Hi,
OPs pic;


-231RPM might mean the motor is turn in reverse.

Why don't you build it and see?

Tom... :slight_smile:

TomGeorge:
Hi,
OPs pic;


-231RPM might mean the motor is turn in reverse.

Why don't you build it and see?

Tom... :slight_smile:

I am planning on building it but the products have not arrived yet, that's why I am doing the simulation so I can proceed with the project.

Get rid of that battory if You even want to think about using motors.