Instructables

Arduino IR remote Sensor L293D - DOUBLE BRIDGE H 600MA

video Arduino IR remote Sensor L293D - DOUBLE BRIDGE H 600MA
My first Arduino Test IR remote Sensor L293D - DOUBLE BRIDGE H 600MA.
Mecanno car . I replced the engine from an RC car , and a servo.
Installed an IR receptor , arduino default package remote control
and some code ... :)
Enjoy :)

//AFFI AYMEN
//27-07-2013 For Instructable
//Arduino / Servo / IR / Meccano / L293D
#include <IRremote.h>
#include <Servo.h>
//IR
int RECV_PIN = 6;
//IR receiver
IRrecv irrecv(RECV_PIN);
decode_results results;
//servo
Servo myservo;// Servo Object
int servoPin = 9;//Servo control PIN
//Motor
int reversePin = 10;//Back PIN
int forwardPin = 11; //forward PIN
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start IR receiver
pinMode(reversePin, OUTPUT);
pinMode(forwardPin, OUTPUT);
myservo.attach(servoPin);
}

void loop()
{
myservo.write(22); //Center Position
if (irrecv.decode(&results))
{
long int decCode = results.value;
Serial.println(decCode);
switch (results.value)
{
case 16718055: Serial.println("Forward"); digitalWrite(reversePin, LOW); digitalWrite(forwardPin, 100); // positiv value OR HIGH break; case 16730805: Serial.println("Reverse"); digitalWrite(forwardPin, LOW); digitalWrite(reversePin, 100); break;
case 16734885: Serial.println("Servo Right"); myservo.write(22); delay(500); myservo.write(30); delay(500); myservo.write(40); delay(1000); myservo.write(30); delay(500); myservo.write(22); break;
case 16716015: Serial.println("Servo Left"); myservo.write(22); delay(500); myservo.write(15); delay(500); myservo.write(5); delay(1000); myservo.write(22); break;
case 16726215: Serial.println("Stop"); digitalWrite(forwardPin, LOW); digitalWrite(reversePin, LOW); break; default: Serial.println("Waiting ...");
}
irrecv.resume(); // Receive the next value from IR
}
}
affiaymen (author) 11 months ago
Need your help about motor speed? Any ideas?
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!