Go Down

Topic: Arduino Remote Trigger (Read 1 time) previous topic - next topic

low5545

This afternoon, I've made a project on my Arduino Uno. It is programmed to light a LED for each button I pressed on a remote control. I've used :








to make my project work! Below is the sketch for my project:

IRremote library download link >>>>>> http://www.dfrobot.com/image/data/DFR0107/IRremote.zip

Code: [Select]

#include <IRremote.h>                // use the library
int receiver = 8;                              // pin 1 of IR receiver to Arduino digital pin 8
IRrecv irrecv(receiver);                 // create instance of 'irrecv'
decode_results results;
int led1=2;
int led2=3;
int led3=4;


void setup()
{
 Serial.begin(9600);                    // for serial monitor output
 irrecv.enableIRIn();                    // Start the receiver
 pinMode(led1,OUTPUT);
 pinMode(led2,OUTPUT);
 pinMode(led3,OUTPUT);
}
void loop()
{
 if (irrecv.decode(&results))       // have we received an IR signal?
 {
   Serial.println(results.value, HEX);  // display it on serial monitor in hexadecimal
   irrecv.resume();                                 // receive the next value
 }            // Your loop can do other things while waiting for an IR command
 //below is triggering mode
 //0x???? ????is the HEX code detected, must add 0x to trigger something
 switch(results.value){
   case 0x458:                   //1st push (UP Button Phillips)
   digitalWrite(led1,HIGH);
   break;
   case 0x10458:              //2nd push
   digitalWrite(led1,HIGH);
   break;
   case 0x45A:                  //1st push (LEFT Button Phillips)
   digitalWrite(led2,HIGH);
   break;
   case 0x1045A:             //2nd push
   digitalWrite(led2,HIGH);
   break;
   case 0x45B:                  //1st push (RIGHT Button Phillips)
   digitalWrite(led3,HIGH);
   break;
   case 0x1045B:             //2nd push
   digitalWrite(led3,HIGH);
   break;
   case 0x45C:                 //1st push (OK Button Phillips)
   digitalWrite(led1,LOW);
   digitalWrite(led2,LOW);  
   digitalWrite(led3,LOW);
   break;
   case 0x1045C:            //2nd push
   digitalWrite(led1,LOW);
   digitalWrite(led2,LOW);  
   digitalWrite(led3,LOW);
   break;
   case 0x459:                 //1st push (DOWN Button Phillips)
   digitalWrite(led1,HIGH);
   digitalWrite(led2,HIGH);  
   digitalWrite(led3,HIGH);
   break;
   case 0x10459:            //2nd push
   digitalWrite(led1,HIGH);
   digitalWrite(led2,HIGH);  
   digitalWrite(led3,HIGH);
   break;
 }
}


Wanna know how it works? Watch the video below!!!! Enjoy!

http://www.youtube.com/watch?v=bGS27KZeEs0&feature=player_embedded

by Weng Fei
http://so1malaysia.blogspot.com/2011/08/arduino-remote-decoder-led-trigger.html
arduino-freelancer.blogspot.com

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy