From 593e0a3ee3c5c2e2b7c17be590b794f4002f8dd2 Mon Sep 17 00:00:00 2001 From: Bluechip Date: Sat, 20 Jun 2015 22:08:13 +0100 Subject: [PATCH] Improve documentation and fixup IRrecvDumpV2.ino --- examples/IRrecvDumpV2/IRrecvDumpV2.ino | 23 +++++++++++------------ ir_Template.cpp | 7 +++++++ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/examples/IRrecvDumpV2/IRrecvDumpV2.ino b/examples/IRrecvDumpV2/IRrecvDumpV2.ino index c6f070c..c9b7ff4 100644 --- a/examples/IRrecvDumpV2/IRrecvDumpV2.ino +++ b/examples/IRrecvDumpV2/IRrecvDumpV2.ino @@ -1,8 +1,7 @@ //------------------------------------------------------------------------------ -// Include the IRremote library headers +// Include the IRremote library header // #include -#include //------------------------------------------------------------------------------ // Tell IRremote which Arduino pin is connected to the IR Receiver (TSOP4838) @@ -28,7 +27,7 @@ void ircode (decode_results *results) Serial.print(results->address, HEX); Serial.print(":"); } - + // Print Code Serial.print(results->value, HEX); } @@ -68,12 +67,12 @@ void dumpInfo (decode_results *results) Serial.println("IR code too long. Edit IRremoteInt.h and increase RAWLEN"); return; } - + // Show Encoding standard Serial.print("Encoding : "); encoding(results); Serial.println(""); - + // Show Code & length Serial.print("Code : "); ircode(results); @@ -123,25 +122,25 @@ void dumpCode (decode_results *results) Serial.print("rawData["); // array name Serial.print(results->rawlen + 1, DEC); // array size Serial.print("] = {"); // Start declaration - + // Dump data for (int i = 0; i < results->rawlen; i++) { Serial.print(results->rawbuf[i], DEC); Serial.print(","); if (!(i&1)) Serial.print(" "); } - + // End declaration Serial.print("0};"); // Turn LED off at the end - + // Comment - Serial.print(" // "); + Serial.print(" // "); encoding(results); Serial.print(" "); ircode(results); - + // Newline - Serial.println(""); + Serial.println(""); } //+============================================================================= @@ -159,4 +158,4 @@ void loop ( ) irrecv.resume(); // Prepare for the next value } } - + diff --git a/ir_Template.cpp b/ir_Template.cpp index 9aa33ae..c0f9606 100644 --- a/ir_Template.cpp +++ b/ir_Template.cpp @@ -66,6 +66,13 @@ Now you must do a few things to add it to the IRremote system: B. Save your changes and close the file +You will probably want to add your new protocol to the example sketch + +3. Open MyDocuments\Arduino\libraries\IRremote\examples\IRrecvDumpV2.ino + + A. In the encoding() function, add: + case SHUZU: Serial.print("SHUZU"); break ; + Now open the Arduino IDE, load up the rawDump.ino sketch, and run it. Hopefully it will compile and upload. If it doesn't, you've done something wrong. Check your work.