Last active
November 14, 2017 07:11
-
-
Save YDKK/2a764519c1e09a847d32f1fe2e4ee97d 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> | |
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