Beginner - L293D doesn't work =(

Hi guys, I need help.
I'm trying to understand how to use an L293D as a simple motor controller, but I'm having troubles!
here is the schematic that I set up in the simulator (everything works in the simulator, but when I set it up at home it didn't work).

// C++ code
//
int velocidade = 0;

void setup()
{
  pinMode(A0, INPUT);
  pinMode(5, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(6, INPUT);
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(7, INPUT);
  pinMode(4, INPUT);
  pinMode(8, INPUT);
}

void loop()
{
  velocidade = map(analogRead(A0), 0, 1023, 0, 1000);
  analogWrite(5, velocidade);
  analogWrite(9, velocidade);
  if (digitalRead(6) == HIGH) {
    digitalWrite(2, HIGH);
    digitalWrite(3, LOW);
    digitalWrite(11, LOW);
    digitalWrite(10, HIGH);
  } else {
    if (digitalRead(7) == HIGH) {
      digitalWrite(2, LOW);
      digitalWrite(3, HIGH);
      digitalWrite(11, HIGH);
      digitalWrite(10, LOW);
    } else {
      if (digitalRead(4) == HIGH) {
        digitalWrite(2, LOW);
        digitalWrite(3, HIGH);
        digitalWrite(11, LOW);
        digitalWrite(10, HIGH);
      } else {
        if (digitalRead(8) == HIGH) {
          digitalWrite(2, HIGH);
          digitalWrite(3, LOW);
          digitalWrite(11, HIGH);
          digitalWrite(10, LOW);
        } else {
          digitalWrite(2, LOW);
          digitalWrite(3, LOW);
          digitalWrite(11, LOW);
          digitalWrite(10, LOW);
        }
      }
    }
  }
  delay(10); // Delay a little bit to improve simulation performance
}

the link doe snot work and we would like to know what is the real setup.

  • show us the circuit as you wired it
  • how are things powered?
  • what are pins 4,6,7 and 8? (and the others?)

Is naming of port pins seams to be useful, isn´t it?

Post the schematic here. I dont want to have to create an account in order to help you.

What is the real world power supply. If it is oneof those smoke alarm 9V batteries, no wonder it won't work.

PP3

One can do so much better than the ancient and inefficient L293 crappy motor driver. The L293 drops 2V to over 4V of the motor voltage and wastes that power as heat. Modern MOSFET output drivers are much more efficient. For battery powered projects that is very important. Pololu has a good line of DC motor drivers.

the forum says I can only post a single image at a time, so I'll use links:

Ports explained
My Circuit

Yes, sorry. In the simulator we don't use code, just boxes with parts of the code...

I can't name the ports in simulator... I still use the simulator because I'm beginner, trying to learn the codes there before I try to code my own programs!

Thanks for the help!

your images so that people don't have to click links


that's a weird looking Arduino UNO and tape instead of soldering might not work as expected

Are GND joined ?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.