Skip to content

Instantly share code, notes, and snippets.

@YDKK
Last active November 14, 2017 07:11
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 YDKK/2a764519c1e09a847d32f1fe2e4ee97d to your computer and use it in GitHub Desktop.
Save YDKK/2a764519c1e09a847d32f1fe2e4ee97d to your computer and use it in GitHub Desktop.
#include <IRremote.h>
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
}
void dump(decode_results *results) {
int count = results->rawlen;
Serial.print("Raw (");
Serial.print(count, DEC);
Serial.print("): ");
for (int i = 0; i < count; i++) {
Serial.print(results->rawbuf[i]*USECPERTICK, DEC);
Serial.print(" ");
}
Serial.println("");
}
void loop() {
if (irrecv.decode(&results)) {
dump(&results);
irrecv.resume(); // Receive the next value
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment