lunes, 17 de abril de 2017

Arduino: controlar LED RGB con control Remoto IR

#include <IRremote.h>;
#include &<IRremoteInt.h>;

int input_pin = 10; //set D10 as input signal pin
IRrecv irrecv(input_pin);
decode_results signals;

void setup()
{
  Serial.begin(9600);
  pinMode(13, OUTPUT);

  pinMode(7, OUTPUT); // rojo
  pinMode(6, OUTPUT); // green
  pinMode(5, OUTPUT); // blue
   
  irrecv.enableIRIn(); // enable input from IR receiver
}
void loop() {
if (irrecv.decode(&signals)) {
    Serial.println(signals.value, HEX);

//boton 0 FF6897 - 1 FF30CF - 2 FF18E7 - 3 FF7A85 - 9 FF52AD
//FF10EF FF38C7 FF5AA5

    if(signals.value == 0xFF6897){ digitalWrite(13,HIGH); }
    
    if(signals.value == 0xFF30CF){ digitalWrite(7,HIGH); }
    if(signals.value == 0xFF10EF){ digitalWrite(7,LOW); }

    if(signals.value == 0xFF18E7){ digitalWrite(6,HIGH); }
    if(signals.value == 0xFF38C7){ digitalWrite(6,LOW); }

    if(signals.value == 0xFF7A85){ digitalWrite(5,HIGH); }
    if(signals.value == 0xFF5AA5){ digitalWrite(5,LOW); }

    if(signals.value == 0xFF52AD){ // apaga todo
      //Serial.println("no");
      digitalWrite(13,LOW);
      digitalWrite(7,LOW); digitalWrite(6,LOW); digitalWrite(5,LOW);
    }
        
    irrecv.resume(); // get the next signal
  }
  
}

video test:

1 comentario:

  1. Lucky Lucky Lucky Casino Japan - Online Casino Japan
    Online Casino Japan. This is ラッキーニッキー the latest 퍼스트 카지노 online casino in Japan. Lucky Lucky Lucky is powered by Microgaming and 메리트카지노 offers a large selection of slots.

    ResponderEliminar