Arduino eeprom data

How can I save the following data to arduino eeprom?
data 1 =53456537
data 2= F46FEF
I need separate code for each, can someone help

Your topic was MOVED to its current forum category which is more appropriate than the original as it has nothing to do with Installation and Troubleshooting of the IDE

What data types are the 2 values ?

1 Like

with

EEPROM.put(address, data)

or update()

Are they strings, char arrays, hex values, or what?

It is an 8 digit variable number. My purpose is actually this. Keep this data in memory, 8 digit variable data from arduino RF, resend when button is pressed ı wrote the description of the code

#include <RCSwitch.h>

RCSwitch mySwitch = RCSwitch();

void setup() {
  Serial.begin(9600);
  mySwitch.enableReceive(0);  // Receiver on interrupt 0 => that is pin #2
}

void loop() {

if (mySwitch.available()) {
    
long veri=mySwitch.getReceivedValue();    //I put the data in long variable
Serial.println( mySwitch.getReceivedValue() ); //I printed the data on the serial port
mySwitch.resetAvailable();
delay(2000);
    
 
}

Serial.println(veri); //but arduino does not see the variable because it is inside if
delay(1000);
}

What about this one ?

@darkmour Recommend you look at the examples in the IDE for EEPROM, and try something using those, and come back with questions.

a variable from the room ir receiver my purpose is to store the incoming data

one is ir receiver data and the other is rf receiver data variable data. all i need is to store them

eeprom only saves up to 3 digit numbers, can you check the code ?

What code would that be ?

I don't think so, anyway have a look at THIS library.

I checked the invisible code and it was working fine.

Try this:

#include <RCSwitch.h>

RCSwitch mySwitch = RCSwitch();

void setup()
{
  Serial.begin(9600);
  mySwitch.enableReceive(0);  // Receiver on interrupt 0 => that is pin #2
}

void loop()
{
  static long veri;
  
  if (mySwitch.available())
  {
    veri = mySwitch.getReceivedValue();  //I put the data in long variable
    Serial.println(veri); //I printed the data on the serial port
    mySwitch.resetAvailable();
    delay(2000);
  }

  Serial.println(veri);
  delay(1000);
}

Note: Your sketch doesn't use EEPROM. Did you want 'veri' to retain its value when the power is off? That would be something like:

#include <RCSwitch.h>
#include <EEPROM.h>

RCSwitch mySwitch = RCSwitch();

long veri;

void setup()
{
  Serial.begin(9600);
  EEPROM.get(0, veri);  // Fetch the previous value from EEPROM at 0
  mySwitch.enableReceive(0);  // Receiver on interrupt 0 => that is pin #2
}

void loop()
{
  if (mySwitch.available())
  {
    veri = mySwitch.getReceivedValue();  //I put the data in long variable
    EEPROM.put(0, veri);   // Store the new value in EEPROM at 0
    Serial.println(veri); //I printed the data on the serial port
    mySwitch.resetAvailable();
    delay(2000);
  }

  Serial.println(veri);
  delay(1000);
}

Hello, thanks a lot, it worked, I no longer need eeprom long veri; your variable got the job done but can I store data like FF64F63 like this?

Do you have any idea of what a "long" variable is, how getReceivedValue() works, and what a hexadecimal value is and represents?

You question looks like someone trying to build a car without any knowledge of mechanics....

I'm new to this. Is there a variable that will allow me to store data like F63FF43?

EEPROM on my nano is supposed to save bytes (maximum in decimal 255, in hex ff, or in binary 11111111).
If you want to save anything bigger than decimal 255 then lookup the bitshift operator and a few things like that in [Help] reference and take apart your bigger data into constituent bytes, which could be saved or read from EEPROM, and write a test program to display to your Serial.print the bignumber, the bytes from it, and a bignumber from putting back together those bytes. Once you've got your bytes working, then do stuff with EEPROM.

there are better ways to do this than bitshifting....