Skip to content

Instantly share code, notes, and snippets.

@halferty
Created May 20, 2018 21:54
Show Gist options
  • Save halferty/bab830e18b53721a6126bfe5ab71a470 to your computer and use it in GitHub Desktop.
Save halferty/bab830e18b53721a6126bfe5ab71a470 to your computer and use it in GitHub Desktop.
IRremote usage arduino
#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