2 * IRremote: IRrecvDump - dump details of IR codes with IRrecv
3 * An IR detector/demodulator must be connected to the input RECV_PIN.
4 * Version 0.1 July, 2009
5 * Copyright 2009 Ken Shirriff
7 * JVC and Panasonic protocol added by Kristian Lauszus (Thanks to zenwheel and other people at the original blog post)
14 IRrecv irrecv(RECV_PIN);
16 decode_results results;
21 irrecv.enableIRIn(); // Start the receiver
24 // Dumps out the decode_results structure.
25 // Call this after IRrecv::decode()
26 // void * to work around compiler issue
27 //void dump(void *v) {
28 // decode_results *results = (decode_results *)v
29 void dump(decode_results *results) {
30 int count = results->rawlen;
31 if (results->decode_type == UNKNOWN) {
32 Serial.print("Unknown encoding: ");
34 else if (results->decode_type == NEC) {
35 Serial.print("Decoded NEC: ");
37 else if (results->decode_type == SONY) {
38 Serial.print("Decoded SONY: ");
40 else if (results->decode_type == RC5) {
41 Serial.print("Decoded RC5: ");
43 else if (results->decode_type == RC6) {
44 Serial.print("Decoded RC6: ");
46 else if (results->decode_type == PANASONIC) {
47 Serial.print("Decoded PANASONIC - Address: ");
48 Serial.print(results->panasonicAddress,HEX);
49 Serial.print(" Value: ");
51 else if (results->decode_type == JVC) {
52 Serial.print("Decoded JVC: ");
54 Serial.print(results->value, HEX);
56 Serial.print(results->bits, DEC);
57 Serial.println(" bits)");
58 Serial.print("Raw (");
59 Serial.print(count, DEC);
62 for (int i = 0; i < count; i++) {
64 Serial.print(results->rawbuf[i]*USECPERTICK, DEC);
67 Serial.print(-(int)results->rawbuf[i]*USECPERTICK, DEC);
76 if (irrecv.decode(&results)) {
77 Serial.println(results.value, HEX);
79 irrecv.resume(); // Receive the next value