store IR code

Hi guys,

I have a question to solve but I'm a newb :-? I used the code http://www.arduino.cc/playground/Code/InfraredReceivers to capture the IR signal of remote control. It seems to work. Now I need to store the last number selected in the remote control and repeat it every time arduino starts. please can anybody help me? Thanks Michele

the eeprom library can be used to permanently save and update your data, more info on this here: http://www.arduino.cc/en/Reference/EEPROM

You would write the data you want to save and read it in setup() when your sketch restarts.

Hi mem, I have tried this:

for (int i = 0; i <64; i++)
{
ByteArray[4i]=(TimerValue>>3)&0xFF;*
_ ByteArray[4i+1]=(TimerValue>>2)&0xFF;_
_ ByteArray[4i+2]=(TimerValue*>>1)&0xFF;
ByteArray[4i+3]=(TimerValue*)&0xFF;
}
for (int i = 0; i <256; i++)
{
EEPROM.write(i,ByteArray);
}
for(byte i=0;i<256;i++)
{
Serial.println(EEPROM.read(i));
}
}*

to write and read eeprom, but nothing, any idea
tancks
michele_

Are your trying to do something like this:

char BytePtr = (char ) TimerValue;
for (int i = 0; i <256; i++)
{
EEPROM.write(i, BytePtr
);

}
for(byte i=0;i<256;i++)
{

  • Serial.println(EEPROM.read(i));*
    }

I tried , but the result is the same, a long series of squares

The code you posted prints the raw bytes stored in the EEPROM.
If you want to read the values back into the TimerValue array and display them as long decimal numbers then try this:

 char *BytePtr = (char *) TimerValue; 

 for (int i = 0; i <256; i++)  
 {  
     EEPROM.write(i, BytePtr[i]);  
 }  
 
 for(int i=0; i < 256; i++)  
 {     
    BytePtr[i] = EEPROM.read(i);     
 }  
 for(int i=0; i < 64; i++)  
 {     
    Serial.print(TimerValue[i]);  
 }