#define move_forward

{

analogWrite(M1a,spd);digitalWrite(M1b,LOW);analogWrite(M2a,spd);digitalWrite(M2b,LOW);

}
#define move_backward

{ digitalWrite(M1a,LOW);analogWrite(M1b,spd);digitalWrite(M2a,LOW);analogWrite(M2b,spd);

}
#define move_left

{

analogWrite(M1a,spd);digitalWrite(M1b,LOW);digitalWrite(M2a,LOW);analogWrite(M2b,spd);

}
#define move_right

{ digitalWrite(M1a,LOW);analogWrite(M1b,spd);analogWrite(M2a,spd);digitalWrite(M2b,LOW);

}
#define move_stop

{

digitalWrite(M1a,LOW);digitalWrite(M1b,LOW);digitalWrite(M2a,LOW);digitalWrite(M2b,LOW);

}
#define M1b 6
#define M1a 5
#define M2b 10
#define M2a 9
#define spd 150

#include <IRremote.h>
IRrecv irrecv(11);
decode_results results;
String s,s1=””;

void setup()
{
Serial.begin(9600);
irrecv.enableIRIn();
pinMode(M1b,OUTPUT);
pinMode(M1a,OUTPUT);
pinMode(M2b,OUTPUT);
pinMode(M2a,OUTPUT);
}

void loop()
{
if(irrecv.decode(&results))
{
s=String(int(results.value));
Serial.println(s);
irrecv.resume();
if(s==”-1″&&s1!=””)
s=s1;
if(s==”21420″)
{
move_forward;
}
else if(s==”19380″)
{
move_backward;
}
else if (s==”-26266″)
{
move_left;
}
else if (s==”-31876″)
{
move_right;
}
else if (s==”29580″)
{
move_stop;
}
s1=s;
delay(50);
}
else
{
move_stop;
}
}

TO BE CONTINUED ……