Go Down

Topic: IRremoteNEC library problem (Solved) (Read 248 times) previous topic - next topic

6v6gt

The NEC Protocol is a LSB (least significant bit) first protocol, hence the transposing of the bits within a byte. I haven't looked in detail at other libraries, and simply worked from the specification, but maybe not all do it cleanly (or there may be a problem with mine). What is interesting is that the difference between them is consistent so I look at mine again.

Anyway, important is that you get a different result for each key pressed otherwise you can't do the mapping.

If you want just the last byte extracted from the 32bit result, you may be able do something like this :

Code: [Select]

byte myByte =  (byte)(nsIrNec::dataOut & 0x000000FF)   ;  // keep only the last byte of an unsigned long
Serial.println( myByte ,HEX) ;

IamFof

I had planned to and it with a mask.  I haven't dealt with masks, for about 20 yrs, so needed to remember how.  You have, and again I must say thanks, supplied me with the mask.


IamFof

FYI.  The merge worked first time.
3rd time lucky.

6v6gt

I'm glad that all worked.
I did notice an error in the library for which I sent you a link. It is true that the bit order within a byte was inverted and I have now corrected this. I've also added a repeat function so, if a button is continuously held, you get an 0xFFFFFFFF returned at 110mS intervals.
I guess though, if you've spent some time developing a mapping table, you may wish to leave it all as it is.

https://forum.arduino.cc/index.php?topic=619622.0

Go Up