Arduino IR Remote Sensor L293D - DOUBLE BRIDGE H 600MA

3,356

15

1

Introduction: 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
}
}

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Weekend Projects Contest

Participated in the
Weekend Projects Contest

Remote Control Contest

Participated in the
Remote Control Contest

Arduino Contest

Participated in the
Arduino Contest

Be the First to Share

    Recommendations

    • Trash to Treasure Contest

      Trash to Treasure Contest
    • Raspberry Pi Contest 2020

      Raspberry Pi Contest 2020
    • Wearables Contest

      Wearables Contest

    Discussions

    0
    affiaymen
    affiaymen

    6 years ago

    Need your help about motor speed? Any ideas?