Created
February 7, 2018 21:07
-
-
Save besi/99ab4d00b5dd538314e7fc0edec7863f to your computer and use it in GitHub Desktop.
This file contains 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
/* | |
Directly attach the IR receiver diode to the Pins: | |
- Left: Signal Pin 2 | |
- Middle: GND | |
- Right: 5V | |
*/ | |
#include <IRremote.h> | |
int RECV_PIN = 2; | |
IRrecv irrecv(RECV_PIN); | |
decode_results results; | |
void setup() { | |
irrecv.enableIRIn(); | |
Serial.begin(115200); | |
pinMode(RECV_PIN, INPUT); | |
} | |
void loop() { | |
if (irrecv.decode(&results)) { | |
int v = results.value; | |
if (v != 0 && v != 0x4AB0F7B6 && v != 0xFFFFF7B6) { | |
Serial.println(v, HEX); | |
} | |
if (v == 0x7887) { | |
Serial.println("Power pressed"); | |
} | |
irrecv.resume(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment