Created
July 14, 2020 20:47
-
-
Save coolreader18/642d4060dcac83e37287e211f860e3ee to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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