SparkFun Forums 

Where electronics enthusiasts find answers.

For the discussion of Arduino related topics.
By brian25
#162590
How to save the password in eeprom? when the device is turn off the pass was still in the chip
and what syntax to use for changing the password?


tnx
Code: Select all
char p1[] = {"11111"};

void Password(){
  
  char p2[5];
  int y = sizeof(p1);
  int flag=0;
  
  for (int x=0;x<=y;x++)
  {
    p2[x]= p1[x];
  }
 
  
  if(gsm.readSMS(smsbuffer, 5, p2, 5) == 0)
  flag=1;
  {
    if(strstr(smsbuffer,"11111") != NULL){
    Serial.println(strcmp(smsbuffer,"Matched"));
    }
    else if(strstr(smsbuffer," ") != NULL){
    flag=2;
    
    
  }
    }
  if(flag==2){    
    Serial.println(strcmp(smsbuffer,"Matched"));
    delF();
    }
    else if(flag==1){    
    Serial.println(strcmp(smsbuffer,"Don't Matched"));
    delF();
   
}
}
  
void delF()
{
 Serial.println("Executing delete");
     for (int j=0;j<=4;++j){     
     Serial.println(sms.DeleteSMS(j));
     }
}