Storing IR codes in EEPROM


I'm trying to figure out a good and simple way to store IR codes to the EEPROM of the Arduino Uno. I am building a DAC and want to create some sort of IR learn function that allows me to teach my DAC the IR codes for certain functions. I'm using Ken Shirriff his IR library to get the codes, but the codes consist out of two sets of 32 bits for nearly all my remotes. If I get it right I can only store 8 bit values to the EEPROM at the time, so I need to split the received value. Now this is where I'm beginning to struggle. I must warn you that I'm really not into bits and byte but I'm eager to learn.

I used this to split the 32 bits binary value into four pieces (probably not the best way)

a = lowByte(results.value);
b = (results.value >> 8);
c = (results.value >> 16);
d = (results.value >> 24);

this is done twice for most IR codes Now I have this four/eight pieces and want to store these to a certain location in the EEPROM, so when a remote is used the code can compare its code to the stored code and should therefore be able to determine which function it should call. I know how to store and read the values in the EEPROM by using a small loop to shift position at the EEPROM, but how to handle remote codes that switch bits between each key press?

I can't see the forest for the trees anymore :disappointed_relieved:

It is probably done before....

Have a look at

That's what I needed. Thanx!

I'm still struggling on how to store IR codes that switch bits back and forth on every key press for a single key. Like the RC5 protocol does. when a single key is pressed once I receive the following value:


Press the same key again and I get this value:


Press it once more and it goes back to the first value:


Storing these codes is not a problem anymore. But I really don't see a simple way to use these codes after storing them. When remote sends the same code every time a single key is pressed it is easy to use it, but when it changes on every key press I need to store both codes and later on compare any new received to both of the stored code or something like that. I know how to compare codes, but there must be a easier method then the one I described.