Skip to content

Instantly share code, notes, and snippets.

@coolreader18
Created July 14, 2020 20:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coolreader18/642d4060dcac83e37287e211f860e3ee to your computer and use it in GitHub Desktop.
Save coolreader18/642d4060dcac83e37287e211f860e3ee to your computer and use it in GitHub Desktop.
#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