Hello i make a robot(Arduino Uno) that it can be controlled with tv remote control.I have the TSOP382 38KHZ and i make this connection
(Vout) Pin 1 to pin 11(Arduino)
(GND) Pin 2 to GND(Arduino)
(Vcc) Pin 3 to 5v(Arduino)
i have upload this sketch in arduino
#include <IRremote.h>
int IRpin = 11 ;
IRrecv irrecv(IRpin);
decode_results results;
int const PWMA = 6;
int const PWMB = 5;
int const dirA = 7;
int const dirB = 4;
void setup ()
{
irrecv.enableIRIn();
pinMode(PWMA, OUTPUT);
pinMode(PWMB, OUTPUT);
pinMode(dirA, OUTPUT);
pinMode(dirB, OUTPUT);
Serial.begin(9600);
}
void loop() {
//if some date is sent, reads it and saves in state
if (irrecv.decode(&results))
{
irrecv.resume(); // Receive the next value
}
if (results.value == 1086314535) // this is where you put in your IR remote button #
{
digitalWrite(dirA, HIGH);
digitalWrite(dirB, HIGH);
analogWrite(PWMA, 255);
analogWrite(PWMB, 255);
{
Serial.println("Go Forward!");
}
}
//if some date is sent, reads it and saves in state
if (irrecv.decode(&results))
{
irrecv.resume(); // Receive the next value
}
if (results.value == 1086322695) // this is where you put in your IR remote button #
{
digitalWrite(dirA, LOW);
digitalWrite(dirB, LOW);
analogWrite(PWMA, 255);
analogWrite(PWMB, 255);
{
Serial.println("Go Backward!");
}
}
//if some date is sent, reads it and saves in state
if (irrecv.decode(&results))
{
irrecv.resume(); // Receive the next value
}
if (results.value == 1086290055) // this is where you put in your IR remote button #
{
digitalWrite(dirA, HIGH);
digitalWrite(dirB, LOW);
analogWrite(PWMA, 255);
analogWrite(PWMB, 255);
{
Serial.println("Turn Left!");
}
}
//if some date is sent, reads it and saves in state
if (irrecv.decode(&results))
{
irrecv.resume(); // Receive the next value
}
if (results.value == 1086281895) // this is where you put in your IR remote button #
{
digitalWrite(dirA, LOW);
digitalWrite(dirB, HIGH);
analogWrite(PWMA, 255);
analogWrite(PWMB, 255);
{
Serial.println("turn Right!");
}
}
//if some date is sent, reads it and saves in state
if (irrecv.decode(&results))
{
irrecv.resume(); // Receive the next value
}
if (results.value == 1086271695) // this is where you put in your IR remote button #
{
digitalWrite(dirA, 0);
digitalWrite(dirB, 0);
analogWrite(PWMA, 0);
analogWrite(PWMB, 0);
{
Serial.println("Stop!");
}
}
}
i press buttons on the serial monitor but nothing show up.I have the IR library installed.I don't know why this happens.Please can you help me?thanks in advance.