Motor shield l293d 4 channel

Need help with motor shield l293d coding. Trying to use it for a RC car. Anyone can help me with the basic codes for activating the motor channels, controlling speed,direction and etc.

What code have You done so faar?

Search "Arduino car L293". There are plenty of examples of projects that people have already made, including all the code. Pick one that looks close and you're at least half way there.

If you need more help you're going to have to give a lot more details like how many motors and what type, what sort of "RC" etc.

Steve

Have you considered that a dinosaur L293 driver eats about 4V from your motor power supply? I.e. for a 5V motor you need a 9V battery at least.

Need code from start to making motor move

If you do a google search for “l293d coding arduino” there are over 230,000 pages. Since those crappy motor drivers are very popular and cheap there are a lot of people using them.

Try some of those pages and come back with more specific questions if you get stuck.

How to activate 2 motors

// Adafruit Motor shield library
// copyright Adafruit Industries LLC, 2009
// this code is public domain, enjoy!

#include <AFMotor.h>

AF_DCMotor motor(1);

void setup() {
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println(“Motor test!”);

// turn on motor
motor.setSpeed(200);

motor.run(RELEASE);
}

void loop() {
uint8_t i;

Serial.print(“tick”);

motor.run(FORWARD);
for (i=0; i<255; i++) {
motor.setSpeed(i);
delay(10);
}

for (i=255; i!=0; i–) {
motor.setSpeed(i);
delay(10);
}

Serial.print(“tock”);

motor.run(BACKWARD);
for (i=0; i<255; i++) {
motor.setSpeed(i);
delay(10);
}

for (i=255; i!=0; i–) {
motor.setSpeed(i);
delay(10);
}

Serial.print(“tech”);
motor.run(RELEASE);
delay(1000);
}

#include <AFMotor.h>

AF_DCMotor motor1(1);
AF_DCMotor motor2(2);
AF_DCMotor motor3(3);
AF_DCMotor motor4(4);
void setup() {
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println(“Motor test!”);

// turn on motor
motor1.setSpeed(200);
motor2.setSpeed(200);
motor3.setSpeed(200);
motor4.setSpeed(200);
motor1.run(RELEASE);
motor2.run(RELEASE);
motor3.run(RELEASE);
motor4.run(RELEASE);
}

void loop() {
uint8_t i;

Serial.print(“tick”);

motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
for (i=0; i<255; i++) {
motor1.setSpeed(i);
motor2.setSpeed(i);
motor3.setSpeed(i);
motor4.setSpeed(i);
delay(10);
}

for (i=255; i!=0; i–) {
motor1.setSpeed(i);
motor2.setSpeed(i);
motor3.setSpeed(i);
motor4.setSpeed(i);
delay(10);
}

Serial.print(“tock”);

motor1.run(BACKWARD);
motor2.run(BACKWARD);
motor3.run(BACKWARD);
motor4.run(BACKWARD);
for (i=0; i<255; i++) {
motor1.setSpeed(i);
motor2.setSpeed(i);
motor3.setSpeed(i);
motor4.setSpeed(i);
delay(10);
}

for (i=255; i!=0; i–) {
motor1.setSpeed(i);
motor2.setSpeed(i);
motor3.setSpeed(i);
motor4.setSpeed(i);
delay(10);
}

Serial.print(“tech”);
motor1.run(RELEASE);
motor2.run(RELEASE);
motor3.run(RELEASE);
motor4.run(RELEASE);
delay(1000);
}

Please read How to use this forum. Post code in Code Tags </>.