Created
May 20, 2018 21:54
-
-
Save halferty/bab830e18b53721a6126bfe5ab71a470 to your computer and use it in GitHub Desktop.
IRremote usage arduino
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> | |
#define RECV_PIN 2; | |
#define B_1 0x92DF9279 | |
#define B_2 0x87CDD0EF | |
#define B_3 0x37788763 | |
IRrecv irrecv(RECV_PIN); | |
void setup() { | |
Serial.begin(9600); | |
Serial.println("Ready to decode IR!"); | |
irrecv.enableIRIn(); | |
} | |
void loop() { | |
if (irrecv.decode(&results)) { | |
Serial.println(results.value, HEX); | |
switch (results.value) { | |
case B_1: | |
Serial.println("Button 1 pressed!"); | |
break; | |
// ... | |
default: | |
break; | |
} | |
irrecv.resume(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment