kindly explain this part of code??

//////////////////////////////////////// Read an ID from EEPROM //////////////////////////////

void readID( uint8_t number )

 {

uint8_t start = (number*8 ) + 2; 

for ( uint8_t i = 0; i < 4; i++ )

 {   

storedCard[i] = EEPROM.read(start + i);  
 
storedPass[i] = EEPROM.read(start + i + 4);

}}

Same as http://forum.arduino.cc/index.php?topic=598124.

yes but i need a definite explanation as on what are the iterations about??

You may (not) have noticed that your code turned italic in the middle. That means that in there somewhere there's a [i] as part of your sketch that browsers take to mean "turn on italics". So perhaps you should put your code in tags

[code]sketch goes here [/code]

so people can actually read it properly?

hannahrj:
yes but i need a definite explanation as on what are the iterations about??

just a wild guess here, but you should know this :slight_smile:

Are the IDs stored 4 byte wide?

If yes, then there’s you answer to “what are the iterations about”

    storedCard[i] = EEPROM.read(start + i);
    storedPass[i] = EEPROM.read(start + i + 4);

Looks like nonsense to me

Are you sure that it shouldn't be

    storedCard[i] = EEPROM.read(start + i);
    storedPass[i + 4] = EEPROM.read(start + i + 4);

EDIT : Ignore the above. I read the code wrongly

void readID( uint8_t number )                 //nunber = 1
{
   uint8_t start = (number*8 ) + 2;         //statrt = 10
   for ( uint8_t i = 0; i < 4; i++ )
   {   
      storedCard[i] = EEPROM.read(start + i); 
     //contents of EEPROM locations 10 to 13 are stored into locations storedCaed[0] to storedCard[3] 
     //of the array named [b]byte storedCard[][/b].
   
      storedPass[i] = EEPROM.read(start + i + 4);  
      //contents of EEPROM locations 14 to 17 are are stored into locations storedPass[0] to storedPass[3] 
      //of the array named [b]byte storedPass[][/b]. 

   }
}

GolamMostafa:

 [b]byte storedCard[][/b].

Formatting tags inside [code] [/code] don't work.

rainbow_rings:
Formatting tags inside [code] [/code] don't work.

I am lucky that these are under comments.

for ( uint8_t i = 0; i < 4; i++ ) {   

storedCard[i] = EEPROM.read(start + i);  
storedPass[i] = EEPROM.read(start + i + 4);
}

So the code thinks that there is an “id” stored in the EEPROM starting at “start”, that consists of 4 bytes of “Card” and then 4 bytes of “Pass.”
It “cleverly” uses a single for loop that runs 4 times, each time reading one byte of Card and one byte of Pass (which is 4 bytes further on in the EEPROM.) It probably saves about a dozen bytes of code over the more obvious technique of reading first the Card and then the Pass. Grr.

or rewrite it from scratch with a simple struct{}
Then use EEPROM.put & get to save all that work.

lastchancename:
or rewrite it from scratch with a simple struct{}
Then use EEPROM.put & get to save all that work.

When the Op's title is: "kindly explain this part of code??", what should we possibly explain?

GolamMostafa:

void readID( uint8_t number )                 //nunber = 1

{
  uint8_t start = (number*8 ) + 2;        //statrt = 10
  for ( uint8_t i = 0; i < 4; i++ )
  { 
      storedCard[i] = EEPROM.read(start + i);
    //contents of EEPROM locations 10 to 13 are stored into locations storedCaed[0] to storedCard[3]
    //of the array named byte storedCard[].
 
      storedPass[i] = EEPROM.read(start + i + 4); 
      //contents of EEPROM locations 14 to 17 are are stored into locations storedPass[0] to storedPass[3]
      //of the array named byte storedPass[].

}
}

Thank you that helped a lot