Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * IRremote: IRrecvDemo - demonstrates receiving IR codes with IRrecv
- * An IR detector/demodulator must be connected to the input RECV_PIN.
- * Version 0.1 July, 2009
- * Copyright 2009 Ken Shirriff
- * http://arcfn.com
- */
- #include <IRremote.h>
- int flag = 0;
- int RECV_PIN = 13;
- const int rele1=8;
- const int rele2=9;
- const int rele3=10;
- const int rele4=11;
- const int rele5=12;
- const int ant1=4;
- const int ant2=5;
- const int ant3=6;
- const int ant4=7;
- IRrecv irrecv(RECV_PIN);
- decode_results results;
- void setup()
- {
- Serial.begin(9600);
- pinMode (8,OUTPUT);
- pinMode (9,OUTPUT);
- pinMode (10,OUTPUT);
- pinMode (11,OUTPUT);
- pinMode (12,OUTPUT);
- pinMode (4,OUTPUT);
- pinMode (5,OUTPUT);
- pinMode (6,OUTPUT);
- pinMode (7,OUTPUT);
- irrecv.enableIRIn(); // Start the receiver
- }
- void loop() {
- if (irrecv.decode(&results)) {
- Serial.println(results.value, DEC);
- if(results.value==1808161144){ // tecla_1
- digitalWrite(ant1,HIGH); // ant1 liga__desliga 2,3,4
- digitalWrite(ant2,LOW);
- digitalWrite(ant3,LOW);
- digitalWrite(ant4,LOW);
- }
- if(results.value==1935374717){ // tecla_2
- digitalWrite(ant2,HIGH); // rele2 liga__desliga 1,3,4
- digitalWrite(ant1,LOW);
- digitalWrite(ant3,LOW);
- digitalWrite(ant4,LOW);
- }
- if(results.value==516431292){ // tecla_3
- digitalWrite(ant3,HIGH); // rele3 liga__desliga 1,2,4
- digitalWrite(ant1,LOW);
- digitalWrite(ant2,LOW);
- digitalWrite(ant4,LOW);
- }
- if(results.value==1158108117){ // tecla_4
- digitalWrite(ant4,HIGH); // rele4 liga__desliga 1,2,3
- digitalWrite(ant1,LOW);
- digitalWrite(ant2,LOW);
- digitalWrite(ant3,LOW);
- }
- if(results.value==584651448){ // vol +
- digitalWrite(rele1,HIGH);
- }
- if(results.value==2003594873){ // vol -
- digitalWrite(rele1,LOW);
- }
- if(results.value==3569241652){ // prev ch
- digitalWrite(rele2,HIGH);
- }
- if(results.value==2464142364){ // mute
- digitalWrite(rele2,LOW);
- }
- if(results.value==2420009732){ // chan +
- digitalWrite(rele3,HIGH);
- }
- if(results.value==1907287989){ // chan -
- digitalWrite(rele3,LOW);
- }
- if(results.value==3121565404){ // tecla_5
- digitalWrite(rele4,HIGH);
- }
- if(results.value==4177530493){ // tecla_8
- digitalWrite(rele4,LOW);
- }
- if(results.value==1254415001){ // tecla_6
- flag = !flag;
- if (flag == 1)
- digitalWrite(rele5,HIGH);
- else
- digitalWrite(rele5,LOW);
- }
- irrecv.resume(); // Receive the next value
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement