Hello!
I need to copy the entire EEPROM from an arduino and send it to another arduino via serial and save the EEPROM sent this second.
In other words, transfer the contents of the entire EEPROM from one arduino to another.
Pseudo codes
sender
for each byte in eeprom
read byte using EEPROM.read
send read byte
wait for confirmation from receiver
Note, there is a function or variable that indicates the length of the eeprom; consult the eeprom reference page
receiver
for each received byte
save to eeprom using EEPROM.update
send confirmation to transmitter
Thank you very much friend!
I had already tried something similar, follow the code:
sender:
void exportarEt(){
Serial.println("exportar etiqueta");
cont1 = 0;//reinicializa contador do menu principal
entra = false;//garante que entra não está pressionado
Serial2.write(0);
Serial.println("escrevi 0");
for(int j = 0; j < 1023; j++){
reenvia:
Serial2.write(EEPROM[j]);
t = 0;
if(Serial2.available()>0){
t = Serial2.read();
while(t != 4){
goto reenvia;
}
Serial.println("enviado o byte");
Serial.println(j);
}
}
Serial.println("certo e desligando");
delay(1000);
asm volatile (" jmp 0");
}
receiver:
if(comDados == 0){
for(int i=0; i < 1023 ; i++){
t = 0;
if(Serial.available()>0){
EEPROM = Serial.read();
- t = 4;*
- }*
- Serial.println("recebi");*
- Serial.write(t);*
- }*
- Serial.println("certo e desligando");*
- delay(1000);*
- asm volatile (" jmp 0");*
- }*
but it did not work