Can someone help me. Voltage at pin input 1 and enable1 (5V) are higher than vcc(0.00V)

int leftMotorsPin1 = 3;
int leftMotorsPin2 = 2;
int rightMotorsPin1 = 5;
int rightMotorsPin2 = 4;
float distFront, distLeft, distRight;
int trigFront = 11, echoFront = 10;
int trigLeft = 7, echoLeft = 6;
int trigRight = 9, echoRight = 8;

void setup() {
  pinMode(leftMotorsPin1, OUTPUT);
  pinMode(leftMotorsPin2, OUTPUT);
  pinMode(rightMotorsPin1, OUTPUT);
  pinMode(rightMotorsPin2, OUTPUT);
 pinMode(trigFront, OUTPUT);
 pinMode(trigLeft, OUTPUT);
 pinMode(trigRight, OUTPUT);
 pinMode(echoFront, INPUT);
 pinMode(echoLeft, INPUT);
 pinMode(echoRight, INPUT);
Serial.begin(9600);
}

void loop() {
  distFront = checkDist (trigFront,echoFront);
  Serial.print("Front distance");
Serial.println(distFront);

if (distFront > 20) {
  go_forward();
  delay(500);

}else{
  distLeft = checkDist (trigLeft, echoLeft);
  Serial.print ("Left distance");
  Serial.print (distLeft);

  distRight= checkDist (trigRight, echoRight);
  Serial.print("Right distance");
  Serial.println(distRight);

  if(distRight>=distLeft) {
    turn_right();
    delay(500);
  }else{
    turn_left();
    delay(500);
  }
}
}

float checkDist (int trig, int echo){
digitalWrite(trig, LOW);
delayMicroseconds(2);
digitalWrite (trig, HIGH);
delayMicroseconds(10);
digitalWrite(trig, LOW);
float dist = pulseIn (echo, HIGH)/148.1;
return dist;
}
void go_forward(){
  digitalWrite(leftMotorsPin1, HIGH);
  digitalWrite(leftMotorsPin2, LOW);
 digitalWrite(rightMotorsPin1, HIGH);
 digitalWrite(rightMotorsPin2, LOW);
 }
void turn_left(){
  digitalWrite(leftMotorsPin1, LOW);
  digitalWrite(leftMotorsPin2, LOW);
 digitalWrite(rightMotorsPin1, HIGH);
 digitalWrite(rightMotorsPin2, LOW);
}
void turn_right(){
  digitalWrite(leftMotorsPin1, HIGH);
  digitalWrite(leftMotorsPin2, LOW);
 digitalWrite(rightMotorsPin1, LOW);
 digitalWrite(rightMotorsPin2, LOW);
}

issue 1

Which VCC is 0 volt (there are two VCC pins).
Assuming this is an L293D...
Pin 16 (VCC1) is logic power, and should be connected to 5volt of the Uno R3.
Pin 8 (VCC2) is motor power, which can be more than 5volt.
Post a real picture of the setup.
Leo..

1 Like

Hi Wawa thanks for replying.

It is a L293D. Pin 16 is connected to 5 V from Arduino and Pin 8 is connected to the 9V battery. This is my first project and the message that comes up is in that bottom picture. Real picture as in the schematic? It looks like Motor 2 is not connected but as far as I can tell it is connected to outputs 4 and 3 and the Inputs are going to the Arduino. Any advise I would really appreciate.

Not in your diagram...

With real picture I mean real picture.
More often than not the problem is in the wiring.
Leo..

I have not built this using physical components yet. I'm using tinkercad to test things out first. Everything seems to be connected is there a limit to how many components you can have on tinkercad?

In the schematic VCC1 is not connected on U2.

Hi,
For everyone's benefit;

Tom.. :smiley: :+1::coffee: :australia: