l293d motor shield with ir remote

Hi everyone i am trying to make a ir controlled robot using ir remote and l293d motor driver shield
here is my code-
#include <AFMotor.h>
#include <IRremote.h>

#define FORWARD 16718055
#define BACK 16730805
#define LEFT 16716015
#define RIGHT 16734885
#define STOP 16726215
#define RECV_PIN 10

AF_DCMotor motor1(3);
AF_DCMotor motor2(4);
IRrecv irrecv(RECV_PIN);
decode_results results;

unsigned long val;
unsigned long preMillis;

void forward()
{
motor1.run(FORWARD);
motor2.run(FORWARD);
Serial.println(“go forward!”);
}

void back()
{
motor1.run(BACKWARD);
motor2.run(BACKWARD);
Serial.println(“go back!”);
}

void left()
{
motor1.run(BACKWARD);
motor2.run(FORWARD);
Serial.println(“go left!”);
}

void right()
{
motor1.run(FORWARD);
motor2.run(BACKWARD);
Serial.println(“go right!”);
}

void stop()
{
motor1.run(RELEASE);
motor2.run(RELEASE);
Serial.println(“STOP!”);
}

void setup()
{
Serial.begin(9600);
stop();
irrecv.enableIRIn();
motor1.run(RELEASE);
motor2.run(RELEASE);
}

void loop() {
if (irrecv.decode(&results)){
preMillis = millis();
val = results.value;
Serial.println(val);
irrecv.resume();
switch(val){
case FORWARD: forward(); break;
case BACK: back(); break;
case LEFT: left(); break;
case RIGHT: right(); break;
case STOP: stop(); break;
default: break;
}
}
else{
if(millis() - preMillis > 150){
stop();
preMillis = millis();
}
}
}

but for some reason the motors aren’t working.
yes i am giving extra power supply through the shield but then also they are not working.
PLEASE HELP

On the serial minitor you see that te commands are correctly received? If yes, please post an image of your curcuit.

yes the serial monitor gives accurate readings
here is the connection (not connected the power supply in this case) and the ir receiver is also disconnected.
link of the photo
https://drive.google.com/open?id=1-2kzQu8ZNAyQSzsc_wKC_hFaUUldJ35b

I am not absolutely wrong (and I have not seen the datasheet of the shield) then you forgot to connect motor power :slight_smile:

Nope.
When power connected then also it does not run.

Is it this shield? https://cdn-learn.adafruit.com/downloads/pdf/adafruit-motor-shield.pdf
If yes, then the description on page 7 does not fit your setup. Amybe you got the wrong library?

Yes it is the shield that I am using.
Can you please tell me why can't it support this setup and can you suggest a good library for it.
Thanks

Sorry, I don't know that. But follow the instructions in the datasheet, it uses different pins then what you defined in the sketch. and it need 2 pins per motor (enabe and direction). Just wiggle the pins with digitalWrite() and observe.

Can you please tell me how to use digitalWrite() with l293d shield.