Commit fdac2d02 authored by Chris Young's avatar Chris Young

Upgrade to version 1.4

Improved debugging macros, added RCMM protocol used by AT&T U-verse
boxes, other changes related to that protocol.
parent f182b12b
Change Log for IRLib – an Arduino library for infrared encoding and decoding
Copyright 2013-2014 by Chris Young http://tech.cyborg5.com/irlib/
Version 1.4 – March 2014
Added IRLIB_ prefix to debug macros to avoid name collisions
Debug macros now report more information
Added example new protocol Phillips RCMM used by AT&T U-Verse boxes and Nokia satellite boxes
Added ABS_MATCH macro which allows you to match using absolute number of microseconds versus the old way which used a percentage. Necessary for implementing RCMM protocol.
Added IRLIB_USE_PERCENT definition which when commented out changes the default from percentage match to absolute match. Also added DEFAULT_ABS_TOLERANCE. More details on these changes will be provided in the documentation when the section on adding new protocols is completed.
Version 1.31 – March 2014
Commented out debug code that was accidentally left active in 1.3 release
Version 1.3 – January 2014
......
This diff is collapsed.
/* IRLib.h from IRLib an Arduino library for infrared encoding and decoding
* Version 1.3 January 2014
* Version 1.4 March 2014
* Copyright 2014 by Chris Young http://cyborg5.com
*
* This library is a major rewrite of IRemote by Ken Shirriff which was covered by
......@@ -33,14 +33,14 @@
// The following are compile-time library options.
// If you change them, recompile the library.
// If TRACE is defined, some debugging information about the decode will be printed
// TEST must be defined for the IRtest unittests to work. It will make some
// If IRLIB_TRACE is defined, some debugging information about the decode will be printed
// IRLIB_TEST must be defined for the IRtest unittests to work. It will make some
// methods virtual, which will be slightly slower, which is why it is optional.
// #define TRACE
// #define TEST
// #define IRLIB_TRACE
// #define IRLIB_TEST
// Only used for testing; can remove virtual for shorter code
#ifdef TEST
#ifdef IRLIB_TEST
#define VIRTUAL virtual
#else
#define VIRTUAL
......@@ -81,7 +81,7 @@ public:
void UseExtnBuf(void *P); //Normally uses same rawbuf as IRrecv. Use this to define your own buffer.
void copyBuf (IRdecodeBase *source);//copies rawbuf and rawlen from one decoder to another
protected:
unsigned char index; // Index into rawbuf used various places
unsigned char offset; // Index into rawbuf used various places
};
class IRdecodeHash: public virtual IRdecodeBase
......@@ -111,10 +111,9 @@ class IRdecodeRC: public virtual IRdecodeBase
public:
enum RCLevel {MARK, SPACE, ERROR};//used by decoders for RC5/RC6
// These are called by decode
RCLevel getRClevel(unsigned char *offset, unsigned char *used, const unsigned int t1);
RCLevel getRClevel(unsigned char *used, const unsigned int t1);
protected:
unsigned char nbits;
unsigned char offset;
unsigned char used;
long data;
};
......
/* IRLibMatch.h from IRLib an Arduino library for infrared encoding and decoding
* Version 1.3 January 2014
* Version 1.4 March 2014
* Copyright 2014 by Chris Young http://cyborg5.com
*
* This library is a major rewrite of IRemote by Ken Shirriff which was covered by
......@@ -31,43 +31,70 @@
#define IRLibMatch_h
/*
* This is some miscellaneous definition that is needed by the decoding routines.
* Originally all timing comparisons for decoding were based on a percent of the
* target value. However when target values are relatively large, the percent tolerance
* is too much. In some instances an absolute tolerance is needed. In order to maintain
* backward compatibility, the default will be to continue to use percent. If you wish to default
* to an absolute tolerance, you should comment out the line below.
*/
#define IRLIB_USE_PERCENT
/*
* These are some miscellaneous definitions that are needed by the decoding routines.
* You need not include this file unless you are creating custom decode routines
* which will require these macros and definitions. Even if you include it, you probably
* don't need to be intimately familiar with the internal details.
*/
#define USECPERTICK 50 // microseconds per clock interrupt tick
#define TOLERANCE 25 // percent tolerance in measurements
#define TICKS_LOW(us) (unsigned int) (((us)*(1.0 - TOLERANCE/100.)))
#define TICKS_HIGH(us) (unsigned int) (((us)*(1.0 + TOLERANCE/100.) + 1))
#define PERCENT_TOLERANCE 25 // percent tolerance in measurements
#define DEFAULT_ABS_TOLERANCE 75 //absolute tolerance in microseconds
/*
* These revised MATCH routines allow you to use either percentage were absolute tolerances.
* Use ABS_MATCH for absolute and PERC_MATCH percentages. The original MATCH macro
* is controlled by the IRLIB_USE_PERCENT definition a few lines above.
*/
#define PERCENT_LOW(us) (unsigned int) (((us)*(1.0 - PERCENT_TOLERANCE/100.)))
#define PERCENT_HIGH(us) (unsigned int) (((us)*(1.0 + PERCENT_TOLERANCE/100.) + 1))
#define ABS_MATCH(v,e,t) ((v) >= ((e)-(t)) && (v) <= ((e)+(t)))
#define PERC_MATCH(v,e) ((v) >= PERCENT_LOW(e) && (v) <= PERCENT_HIGH(e))
#ifdef IRLIB_USE_PERCENT
#define MATCH(v,e) PERC_MATCH(v,e)
#else
#define MATCH(v,e) ABS_MATCH(v,e,DEFAULT_ABS_TOLERANCE)
#endif
#define MATCH(measured_ticks, desired_us) ((measured_ticks) >= TICKS_LOW(desired_us) && (measured_ticks) <= TICKS_HIGH(desired_us))
//The following two routines are no longer necessary because mark/space adjustments are done elsewhere
//These definitions maintain backward compatibility.
#define MATCH_MARK(t,u) MATCH(t,u)
#define MATCH_SPACE(t,u) MATCH(t,u)
#ifdef TRACE
void ATTEMPT_MESSAGE(const __FlashStringHelper * s);
void TRACE_MESSAGE(const __FlashStringHelper * s);
byte REJECTION_MESSAGE(const __FlashStringHelper * s);
#define RAW_COUNT_ERROR REJECTION_MESSAGE(F("number of raw samples"));
#define HEADER_MARK_ERROR REJECTION_MESSAGE(F("header mark"));
#define HEADER_SPACE_ERROR REJECTION_MESSAGE(F("header space"));
#define DATA_MARK_ERROR REJECTION_MESSAGE(F("data mark"));
#define DATA_SPACE_ERROR REJECTION_MESSAGE(F("data space"));
#define TRAILER_BIT_ERROR REJECTION_MESSAGE(F("RC5/RC6 trailer bit length"));
#ifdef IRLIB_TRACE
void IRLIB_ATTEMPT_MESSAGE(const __FlashStringHelper * s);
void IRLIB_TRACE_MESSAGE(const __FlashStringHelper * s);
byte IRLIB_REJECTION_MESSAGE(const __FlashStringHelper * s);
byte IRLIB_DATA_ERROR_MESSAGE(const __FlashStringHelper * s, unsigned char index, unsigned int value, unsigned int expected);
#define RAW_COUNT_ERROR IRLIB_REJECTION_MESSAGE(F("number of raw samples"));
#define HEADER_MARK_ERROR(expected) IRLIB_DATA_ERROR_MESSAGE(F("header mark"),offset,rawbuf[offset],expected);
#define HEADER_SPACE_ERROR(expected) IRLIB_DATA_ERROR_MESSAGE(F("header space"),offset,rawbuf[offset],expected);
#define DATA_MARK_ERROR(expected) IRLIB_DATA_ERROR_MESSAGE(F("data mark"),offset,rawbuf[offset],expected);
#define DATA_SPACE_ERROR(expected) IRLIB_DATA_ERROR_MESSAGE(F("data space"),offset,rawbuf[offset],expected);
#define TRAILER_BIT_ERROR(expected) IRLIB_DATA_ERROR_MESSAGE(F("RC5/RC6 trailer bit length"),offset,rawbuf[offset],expected);
#else
#define ATTEMPT_MESSAGE(s)
#define TRACE_MESSAGE(s)
#define REJECTION_MESSAGE(s) false
#define IRLIB_ATTEMPT_MESSAGE(s)
#define IRLIB_TRACE_MESSAGE(s)
#define IRLIB_REJECTION_MESSAGE(s) false
#define IRLIB_DATA_ERROR_MESSAGE(s,i,v,e) false
#define RAW_COUNT_ERROR false
#define HEADER_MARK_ERROR false
#define HEADER_SPACE_ERROR false
#define DATA_MARK_ERROR false
#define DATA_SPACE_ERROR false
#define TRAILER_BIT_ERROR false
#define HEADER_MARK_ERROR(expected) false
#define HEADER_SPACE_ERROR(expected) false
#define DATA_MARK_ERROR(expected) false
#define DATA_SPACE_ERROR(expected) false
#define TRAILER_BIT_ERROR(expected) false
#endif
#endif //IRLibMatch_h
/* IRLibRData.h from IRLib – an Arduino library for infrared encoding and decoding
* Version 1.3 January 2014
* Version 1.4 March 2014
* Copyright 2014 by Chris Young http://cyborg5.com
*
* This library is a major rewrite of IRemote by Ken Shirriff which was covered by
......
/* IRLibTimer.h from IRLib an Arduino library for infrared encoding and decoding
* Version 1.3 January 2014
* Version 1.4 March 2014
* Copyright 2014 by Chris Young http://cyborg5.com
*
* This library is a major rewrite of IRemote by Ken Shirriff which was covered by
......
......@@ -69,6 +69,7 @@ Samsung36 Demonstrates how to expand the library without recompiling it.
Also demonstrates how to handle codes that are longer than 32 bits.
DirecTV Demonstrates additional protocol for DirecTV
GIcable Demonstrates additional protocol for GIcable used by Motorola cable boxes
rcmm Additional protocol Phillips RCMM used by AT&T U-Verse boxes
Note: I did not port any of the other demo sketches although I may add IRTest later.
The manuals directory contains:
IRLibReference.docx Reference manual in Microsoft Word format
......
/* Example program for from IRLib – an Arduino library for infrared encoding and decoding
* Version 1.3 January 2014
* Version 1.4 March 2014
* Copyright 2014 by Chris Young http://cyborg5.com
* Based on original example sketch for IRremote library
* Version 0.11 September, 2009I know prescription and no
......@@ -52,17 +52,17 @@ public:
*/
bool IRdecodeDirecTV::decode(void) {
long data; int offset;
ATTEMPT_MESSAGE(F("DirecTV"));
IRLIB_ATTEMPT_MESSAGE(F("DirecTV"));
if (rawlen != 20) return RAW_COUNT_ERROR;
if (MATCH(rawbuf[1],3000))
Repeat=true;
else
if (!MATCH(rawbuf[1],6000)){
return HEADER_MARK_ERROR;
return HEADER_MARK_ERROR(6000);
} else {
Repeat=false;
}
if (!MATCH(rawbuf[2],1200)) return HEADER_SPACE_ERROR;
if (!MATCH(rawbuf[2],1200)) return HEADER_SPACE_ERROR(1200);
offset=3; data=0;
while (offset < 18) {
if (MATCH(rawbuf[offset],1200)) {
......@@ -71,7 +71,7 @@ bool IRdecodeDirecTV::decode(void) {
else if (MATCH(rawbuf[offset],600)) {
data <<= 1;
}
else return DATA_MARK_ERROR;
else return DATA_MARK_ERROR(1200);
offset++;
if (MATCH(rawbuf[offset],1200)) {
data = (data << 1) | 1;
......@@ -79,10 +79,10 @@ bool IRdecodeDirecTV::decode(void) {
else if (MATCH (rawbuf[offset],600)) {
data <<= 1;
}
else return DATA_SPACE_ERROR;
else return DATA_SPACE_ERROR(1200);
offset++;
}
if (!MATCH(rawbuf[1],6000)) return DATA_MARK_ERROR;
if (!MATCH(rawbuf[1],6000)) return DATA_MARK_ERROR(6000);
bits = 16;//set bit length
value = data;//put remaining bits in value
decode_type= static_cast<IRTYPES>DIRECTV;
......@@ -152,7 +152,7 @@ int RECV_PIN = 11;
IRrecv My_Receiver(RECV_PIN);
IRTYPES codeType; // The type of code
unsigned long codeValue; // The data bits
int codeBits; // The length of the code in bits or for Samsung is storage for data2
int codeBits; // The length of the code in bits
bool GotOne;
void setup()
......@@ -167,7 +167,11 @@ void setup()
My_Receiver.enableIRIn(); // Start the receiver
}
void loop() {
if (Serial.read() != -1) {
if (Serial.available()>0) {
unsigned char c=Serial.read();
if (c=='p') {//Send a test pattern
GotOne= true; codeType=DIRECTV; codeValue=0x1234; codeBits=16;
}
if(GotOne) {
My_Sender.send(codeType,codeValue,codeBits);
Serial.print(F("Sent "));
......
/* Example program for from IRLib – an Arduino library for infrared encoding and decoding
* Version 1.3 January 2014
* Version 1.4 March 2014
* Copyright 2014 by Chris Young http://cyborg5.com
* Based on original example sketch for IRremote library
* Version 0.11 September, 2009I know prescription and no
......@@ -36,7 +36,7 @@ public:
* is "{38.7k,490}<1,-4.5|1,-9>(18,-9,F:8,D:4,C:4,1,-84,(18,-4.5,1,-178)*) {C = -(D + F:4 + F:4:4)}"
*/
bool IRdecodeGIcable::decode(void) {
ATTEMPT_MESSAGE(F("GIcable"));
IRLIB_ATTEMPT_MESSAGE(F("GIcable"));
// Check for repeat
if (rawlen == 4 && MATCH(rawbuf[1], 490*18) && MATCH(rawbuf[2],2205)) {
bits = 0;
......@@ -50,7 +50,6 @@ bool IRdecodeGIcable::decode(void) {
};
void IRsendGIcable::send(unsigned long data, bool Repeat) {
ATTEMPT_MESSAGE(F("sending GIcable"));
if(Repeat) {
enableIROut(39);
mark (490*18); space (2205); mark (490); space(220);delay (87);//actually "space(87200);"
......@@ -119,7 +118,11 @@ void setup()
My_Receiver.enableIRIn(); // Start the receiver
}
void loop() {
if (Serial.read() != -1) {
if (Serial.available()>0) {
unsigned char c=Serial.read();
if (c=='p') {//Send a test pattern
GotOne= true; codeType=GICABLE; codeValue=0x1234; codeBits=16;
}
if(GotOne) {
My_Sender.send(codeType,codeValue,codeBits);
Serial.print(F("Sent "));
......
/* Example program for from IRLib – an Arduino library for infrared encoding and decoding
* Version 1.3 January 2014
* Version 1.4 March 2014
* Copyright 2014 by Chris Young http://cyborg5.com
* Based on original example sketch for IRremote library
* Version 0.11 September, 2009I know prescription and no
......@@ -78,28 +78,28 @@ public virtual IRsendSamsung36 //No comma here
* We then call it in a loop as needed.
*/
bool IRdecodeSamsung36::GetBit(void) {
if (!MATCH(rawbuf[offset],500)) return DATA_MARK_ERROR;
if (!MATCH(rawbuf[offset],500)) return DATA_MARK_ERROR(500);
offset++;
if (MATCH(rawbuf[offset],1500))
data = (data << 1) | 1;
else if (MATCH(rawbuf[offset],500))
data <<= 1;
else return DATA_SPACE_ERROR;
else return DATA_SPACE_ERROR(1500);
offset++;
return true;
};
bool IRdecodeSamsung36::decode(void) {
ATTEMPT_MESSAGE(F("Samsung36"));
IRLIB_ATTEMPT_MESSAGE(F("Samsung36"));
if (rawlen != 78) return RAW_COUNT_ERROR;
if (!MATCH(rawbuf[1],4500)) return HEADER_MARK_ERROR;
if (!MATCH(rawbuf[2],4500)) return HEADER_SPACE_ERROR;
if (!MATCH(rawbuf[1],4500)) return HEADER_MARK_ERROR(4500);
if (!MATCH(rawbuf[2],4500)) return HEADER_SPACE_ERROR(4500);
offset=3; data=0;
//Get first 16 bits
while (offset < 16*2+2) if(!GetBit()) return false;
//Skip middle header
if (!MATCH(rawbuf[offset],500)) return DATA_MARK_ERROR;
if (!MATCH(rawbuf[offset],500)) return DATA_MARK_ERROR(500);
offset++;
if (!MATCH(rawbuf[offset],4500)) return DATA_SPACE_ERROR;
if (!MATCH(rawbuf[offset],4500)) return DATA_SPACE_ERROR(4400);
//save first 16 bits in "value2" and reset data
offset++; value2=data; data=0;
//12 bits into this second segment there is a 68us space
......@@ -217,7 +217,11 @@ void setup()
My_Receiver.enableIRIn(); // Start the receiver
}
void loop() {
if (Serial.read() != -1) {
if (Serial.available()>0) {
unsigned char c=Serial.read();
if (c=='p') {//Send a test pattern
GotOne= true; codeType=SAMSUNG36; codeValue=0x12345; codeBits=0x6789;
}
if(GotOne) {
My_Sender.send(codeType,codeValue,codeBits);
Serial.print(F("Sent "));
......
/* Example program for from IRLib – an Arduino library for infrared encoding and decoding
* Version 1.4 March 2014
* Copyright 2014 by Chris Young http://cyborg5.com
* Based on original example sketch for IRremote library
* Version 0.11 September, 2009I know prescription and no
* Copyright 2009 Ken Shirriff
* http://www.righto.com/
*/
/*
* This example demonstrates how to extend this library to add a new protocol
* without actually modifying or recompiling the libnonstickrary itself. It implements the
* Phillips RC-MM also known as Nokia Protocol. Is used by AT&T U-Verse cable boxes.
* There are three different varieties that are 12, 24, or 32 bits.
* This is a modified version of the IRecord example.
* If you would like to make this a permanent part of your library you could copy the class
* prototypes to IRLib.h and the code itself to IRLib.cpp. Search for the word "ADDITIONAL"
* to see where to add various pieces of code. Also see the Samsung36 example for details.
*/
#include <IRLib.h>
#include <IRLibMatch.h>
class IRdecodeRCMM: public virtual IRdecodeBase
{
public:
bool decode(void);
};
class IRsendRCMM: public virtual IRsendBase
{
public:
void send(unsigned long data, unsigned char nbits);
};
#define RCMM (LAST_PROTOCOL+1)
#define RCMM_HEAD_MARK 417
#define RCMM_DATA_MARK 167
#define RCMM_ZERO 278
#define RCMM_ONE 444
#define RCMM_TWO 611
#define RCMM_THREE 778
/*
* According to http://www.hifi-remote.com/johnsfine/DecodeIR.html#Nokia
* The IRP notation for these protocols are:
* Nokia 12 bit: {36k,msb}<164,-276|164,-445|164,-614|164,-783>(412,-276,D:4,F:8,164,-???)+
* Nokia 24-bit: {36k,msb}<164,-276|164,-445|164,-614|164,-783>(412,-276,D:8,S:8,F:8,164,-???)+
* Nokia 32 bit: {36k,msb}<164,-276|164,-445|164,-614|164,-783>(412,-276,D:8,S:8,X:8,F:8,164,^100m)+
* Slightly different timing values are documented at
* http://www.sbprojects.com/knowledge/ir/rcmm.php
* We will use the timing from the latter reference.
* Unlike most protocols which defined sequences for a logical "0" and "1", this protocol
* encodes 2 bits per pulse. Therefore it encodes a logical "2" and "3" as well.
* The length of the mark is constant but the length of the space denotes the bit values.
* Note the 32-bit version uses a toggle bit of 0x8000 and as usual it is up to the end-user
* to implement it outside the library routines.
*/
/*
* Normally IRLib uses a plus or minus percentage to determine if an interval matches the
* desired value. However this protocol uses extremely long intervals of similar length.
* For example using the default 25% tolerance the RCMM_TWO value 611 would be accepted for
* anything between 458 and 763. The low end is actually closer to RCMM_ONE value of 444
* and the upper range is closer to RCM_THREE value of 778. To implement this protocol
* we created a new match routine ABS_MATCH which allows you to specify an absolute
* number of microseconds of tolerance for comparison.
*/
#define RCMM_TOLERANCE 80
bool IRdecodeRCMM::decode(void) {
long data;
IRLIB_ATTEMPT_MESSAGE(F("RCMM"));
if ( (rawlen!=(12+2)) && (rawlen!=(24+2)) && (rawlen!=(32+4)) ) return RAW_COUNT_ERROR;
if (!MATCH(rawbuf[1],RCMM_HEAD_MARK)) return HEADER_MARK_ERROR(RCMM_HEAD_MARK);
if (!MATCH(rawbuf[2],RCMM_ZERO)) return HEADER_SPACE_ERROR(RCMM_ZERO);
offset=3; data=0;
while (offset < (rawlen-1)) {
if (!ABS_MATCH(rawbuf[offset],RCMM_DATA_MARK, RCMM_TOLERANCE+50)) return DATA_MARK_ERROR(RCMM_DATA_MARK);
offset++;
if (ABS_MATCH(rawbuf[offset],RCMM_ZERO, RCMM_TOLERANCE) ) { //Logical "0"
data <<= 2;
}
else if (ABS_MATCH(rawbuf[offset],RCMM_ONE, RCMM_TOLERANCE) ) { //Logical "1"
data = (data<<2) + 1;
}
else if (ABS_MATCH(rawbuf[offset],RCMM_TWO, RCMM_TOLERANCE) ) { //Logical "2"
data = (data<<2) + 2;
}
else if (ABS_MATCH(rawbuf[offset],RCMM_THREE, RCMM_TOLERANCE) ) { //Logical "3"
data = (data<<2) + 3;
}
else return DATA_SPACE_ERROR(RCMM_ZERO);
offset++;
}
if (!MATCH(rawbuf[offset],RCMM_DATA_MARK)) return DATA_MARK_ERROR(RCMM_DATA_MARK);
bits = rawlen-4;//set bit length
value = data;//put remaining bits in value
decode_type= static_cast<IRTYPES>RCMM;
return true;
};
void IRsendRCMM::send(unsigned long data, unsigned char nbits) {
Extent=0;
data = data << (32 - nbits);
nbits=nbits/2;
enableIROut(36);
mark(RCMM_HEAD_MARK); space(RCMM_ZERO);//Send header
for (int i = 0; i < nbits; i++) {
mark(RCMM_DATA_MARK);
switch (data & 0xC0000000UL) {//use the leftmost two bits
case 0x00000000UL: space(RCMM_ZERO); break;
case 0x40000000UL: space(RCMM_ONE); break;
case 0x80000000UL: space(RCMM_TWO); break;
case 0xC0000000UL: space(RCMM_THREE); break;
default: Serial.println("sending error");
}
data <<= 2;
};
mark(RCMM_DATA_MARK);
space(27778-Extent);
};
//Create a custom class that combines this new protocol with all the others
class MyCustomSend:
public virtual IRsend,
public virtual IRsendRCMM
{
public:
void send(IRTYPES Type, unsigned long data, int nbits);
};
void MyCustomSend::send(IRTYPES Type, unsigned long data, int nbits) {
if (Type==RCMM)
IRsendRCMM::send(data,nbits);
else
IRsend::send(Type, data, nbits);
}
class MyCustomDecode:
public virtual IRdecode,
public virtual IRdecodeRCMM
{
public:
virtual bool decode(void); // Calls each decode routine individually
void DumpResults(void);
};
bool MyCustomDecode::decode(void) {
if (IRdecodeRCMM::decode()) return true;
return IRdecode::decode ();
}
void MyCustomDecode::DumpResults(void){
if(decode_type==RCMM) {
Serial.print(F("Decoded RCMM: Value:")); Serial.print(value, HEX);
};
IRdecode::DumpResults();
};
MyCustomDecode My_Decoder;
MyCustomSend My_Sender;
int RECV_PIN = 11;
IRrecv My_Receiver(RECV_PIN);
IRTYPES codeType; // The type of code
unsigned long codeValue; // The data bits
int codeBits; // The length of the code in bits or for Samsung is storage for data2
bool GotOne;
char c;
void setup()
{
GotOne=false;
codeType=UNKNOWN;
codeValue=0;
codeBits=0;
Serial.begin(9600);while (! Serial) {};
Serial.println(F("Send a code from your remote and we will record it."));
Serial.println(F("Type any character and press enter. We will send the recorded code."));
My_Receiver.enableIRIn(); // Start the receiver
My_Receiver.Mark_Excess=40;
}
void loop() {
if (Serial.available()>0) {
c=Serial.read();
if (c=='p') {//Send a test pattern
GotOne= true; codeType=RCMM; codeValue=0x12345678; codeBits= 32;
}
if(GotOne) {
My_Sender.send(codeType,codeValue,codeBits);
Serial.print(F("Sent "));
if (codeType== RCMM) Serial.print(F("RCMM")); else Serial.print(Pnames(codeType));
Serial.print(F(" Value:0x"));
Serial.print(codeValue, HEX);
Serial.print(F(" Bits:"));
Serial.println(codeBits, DEC);
My_Receiver.enableIRIn(); // Re-enable receiver
}
}
else if (My_Receiver.GetResults(&My_Decoder)) {
My_Decoder.decode();
if(My_Decoder.decode_type == UNKNOWN) {
Serial.println(F("Unknown type received. Ignoring."));
} else {
codeType= My_Decoder.decode_type;
codeValue= My_Decoder.value;
codeBits= My_Decoder.bits;
GotOne=true;
}
My_Decoder.DumpResults();
delay(1000);
My_Receiver.resume();
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment