Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#include <IRremote.h>
const int RECV_PIN = 7, LED_PIN = 3;
IRrecv irrecv(RECV_PIN);
decode_results results;
unsigned long key_value = 0;
void setup() {
Serial.begin(9600);
irrecv.enableIRIn();
irrecv.blink13(true);
pinMode(LED_PIN, OUTPUT);
}
void loop() {
if (irrecv.decode(&results)) {
if (results.value == 0XFFFFFFFF)
results.value = key_value;
switch (results.value) {
case 0xFFA857:
// minus
if (Serial) Serial.println("-");
digitalWrite(LED_PIN, LOW);
break;
case 0xFF906F:
// plus
if (Serial) Serial.println("+");
digitalWrite(LED_PIN, HIGH);
break;
}
key_value = results.value;
irrecv.resume();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment