Forum Software Ferduino code Question about EEPROM

Question about EEPROM  [SOLVED]


Post Number:#1 Post Sun Oct 07, 2018 7:02 am
Posts: 7
Topics: 5
Images: 2
Solve rating: 0
Joined: Tue Aug 07, 2018 3:09 am
Topics: 5
Age: 70
Gender: None specified
National Flag:
Spain
Dear Fernando, I apologize for the basics of this question but after reading and rereading several pages about the EEPROM and the pointers I do not quite understand a part of your code.
In the following piece of code:

void SaveLEDToEEPROM()
{
  byte k = 222;
  EEPROM.write(796, k);         // Salva ponteiro para os LEDs na EEPROM
  for (int i = 1; i < 97; i++)
  {
    EEPROM.write(i, wled[i - 1]);
    EEPROM.write(i + 96, bled[i - 1]);
    EEPROM.write(i + (96 * 2), rbled[i - 1]);
    EEPROM.write(i + (96 * 3), rled[i - 1]);
    EEPROM.write(i + (96 * 4), uvled[i - 1]);
  }
  SalvarCanalExtraEEPROM();
}

void SaveTempToEEPROM()
{
  byte k = 66;
  EEPROM.write(693, k);
  tempSettings.tempset = int(setTempC * 10);
  tempSettings.tempoff = int(offTempC * 10);
  tempSettings.tempalarm = int(alarmTempC * 10);
  EEPROM_writeAnything(482, tempSettings);
}

void SalvartpaEEPROM()
{
  EEPROM.write(488, hora);
  EEPROM.write(489, minuto);
  EEPROM.write(490, duracaomaximatpa);

  for (byte i = 0; i < 7; i++)
  {
    EEPROM.write((491 + i), semana_e[i]);
  }
}

void SavePHRToEEPROM()
{
  EEPROM.write(508, (setPHR * 10));
  EEPROM.write(509, (offPHR * 10));
  EEPROM.write(510, (alarmPHR * 10));
}

void SaveORPToEEPROM()
{
  byte k = 66;
  EEPROM.write(705, k);
  ORPSettings.ORPset = int(setORP);
  ORPSettings.ORPoff = int(offORP);
  ORPSettings.ORPalarm = int(alarmORP);
  EEPROM_writeAnything(514, ORPSettings);
}


I do not understand why variable "byte" acquires different values, normally it is "66", sometimes it is "222" and sometimes it does not exist.
I just need a brief explanation or a link to some website that gives examples for newbies.
Again my apologies for bothering you with such basic questions. Best regards.

Post Number:#2 Post Sun Oct 07, 2018 6:22 pm
Posts: 1591
Topics: 38
Images: 271
Solve rating: 216
Joined: Mon Mar 03, 2014 5:59 pm
Topics: 38
Age: 35
Location: São Paulo
Gender: Male
National Flag:
Brazil

Hi!

This are random values that I have selected. It can be any number.

It's to know if configuration of some parameter were saved in EEPROM sometime.

If the value never was saved this default values will be used.

I'm not a monster don't need ask with all this fear.

Best regards.
Please do not PM me for support unless it is absolutely necessary.

I'll not write custom function to nobody unless you can pay for my job.




Return to Ferduino code





Who is online

Users viewing this topic: No registered users and 1 guest

cron