how do I store the no1 in permeant memory

Okay, I have got so far from scratch and reading and investigating(playing), however I am struggling to find a way to permanently store the mobile number, once its been entered into the serial monitor.

(LONG TERM GOAL:- to read SMS and store the number, but one step at a time, plus other refinements).

the following code, will allow me to select a case in the serial monitor.

case 1 sends a pre defined message (uses mobile number set in case m)
case 2 sends a different pre defined message(uses mobile number set in case m)
case d gets module to call, you, hang up and dial again(uses mobile number set in case m)
case m allows you to enter a mobile number in serial monitor
case n lets you see the current mobile number stored

this is all well and good if the module is kept powered up, or the serial is not restarted.

can anyone point me in the right direction, either a tutorial that should explain how to achieve this, if my understanding is correct I cant use EEPROM to store, or rather I have to store it in separate allocations for each character, which seems a little mental.

This code may not be pretty, but it at least it works. excluding permeant number storage.

The code:-

#include <SoftwareSerial.h>
SoftwareSerial mySerial(7, 8);
String no1;
String SMS1;
String ATD1= "ATD" + no1+";";

String Message2="Alarm";
String Siteid="Home\r";
String Message;
String Message1="Arm";


void setup()

{

  mySerial.begin(9600);   // Setting the baud rate of GSM Module 
  Serial.begin(9600);    // Setting the baud rate of Serial Monitor (Arduino)
  delay(100);
}
void loop()

{
  if (Serial.available()>0)
   switch(Serial.read())
  
  {  
    case '1':
    
     Message = Siteid+Message1;
     SendMessage();
     break;

     case '2':
     Message = Siteid+Message2;
     SendMessage();
     break;
   
     case'd':
     DialCall();
     break;

     case 'm':
     Number();
     break;

     case 'n':
     Current();
     break;
   
   default:
      RecieveMessage();
      break;
      }

 if (mySerial.available()>0)
   Serial.write(mySerial.read());
   
}

 void SendMessage()
{
  
  mySerial.println("AT+CMGF=1");    //Sets the GSM Module in Text Mode
  delay(1000);  // Delay of 1000 milli seconds or 1 second
  SMS1 ="AT+CMGS=\"" + no1 + "\"\n\r";
  mySerial.println(SMS1); // Replace x with mobile number mySerial.println("AT+CMGS=\"xxxxxxxxxx\"\n\r");
  delay(1000);
  mySerial.println(Message);// The SMS text you want to send
  delay(100);
  mySerial.println((char)26);// ASCII code of CTRL+Z
  delay(1000);

}

void RecieveMessage()

{
  mySerial.println("AT+CNMI=2,2,0,0,0\r"); // AT Command to recieve a live SMS
   delay(1000);
}

void DialCall()
 {
  
  mySerial.println(ATD1); // ATDxxxxxxxxxx; -- watch out here for semicolon at the end!!"ATD07815698180;"
  delay(30000);
  mySerial.println("ATH");
  delay(10000);
  mySerial.println("ATDL");
 }

 void Number()
 {Serial.println(" Enter Mobile Number:");// prompt user input
 while(Serial.available()==0){}//wait for user input
 no1 = Serial.readString(); //read input
Serial.println(no1);
}

 void Current()
 {Serial.println("Current Mobile No:");
 Serial.println(no1);
}

which seems a little mental.

Why? If you have something that takes 10 boxes to fit it all in, do you whine about needing so many boxes? Or, do you just suck it up and use 10 boxes?

lol,

actually if need ten boxes to get my stuff in I would look to see if I can repack it into less, then if I cant and I only have 5 boxes I go get another 5, only if I there is no other solution.

when shipping, rates for shipping vary on box size/ number of box's and a pallet with a large box to put items in can work out cheaper to send than 10 individual box's.

so is there a smarter way to permanently store the mobile numbers once entered?
If so how/ where should I look?
If not, what is the best way to use EEPROM/ examples/ tutorials (so I can learn properly how it works)?

so is there a smarter way to permanently store the mobile numbers once entered?

Smarter than what? Using 10 bytes in EEPROM to store a 10 digit phone number is not going to break the bank.

If not, what is the best way to use EEPROM

There are two main functions - read() and write(). Each puts or gets one byte/char from one address in EEPROM. Dirt simple to use, really.

okay Paul, I will revisit the tutorial I found and see if I can get it working and understand it.

I'll be back...... probably

Thanks for taking the time to reply.

I have to store it in separate allocations for each character

Correct.

A telephone number should be split and stored as a series of characters, for instance;

0800 1234 56789
+44 800 1234 56789

which seems a little mental.

Can you think of another way of storing all those individual characters ?

Look at the [color=blue] eeprom_put[/color] example (among others) in the IDE - File/examples/eeprom

I will have a look, Thanks

just managed to write and store something to EEPROM and recall and prove it was stored there so I will look at this a little more and get back and thanks for your input.

Step by step as running before I can walk will trip me up.

Okay now I have managed to get something into EEPROM and test its validity as to working, ie mobile number wasn't recalled after restore but the EE1 value was

and it couldn't have been entered, as setup in m and tested it in n, now just have to go through storing the whole number of the mobile, or at least two separate numbers to start with.

Thanks for the input.

void Number()
 {Serial.println(" Enter Mobile Number:");// prompt user input
 while(Serial.available()==0){}//wait for user input
 no1 = Serial.readString(); //read input
Serial.println(no1);

Serial.println(" Enter EEPROM value");// prompt user input
while(Serial.available()==0){}//wait for user input
EE1 = Serial.parseInt(); //read input
EEPROM.write(256,EE1);
Serial.println(EEPROM.read(256));
}

 void Current()
 {Serial.println("Current Mobile No:");
 Serial.println(no1);
 Serial.println("Current EEPROM address 256:");
 Serial.println(EEPROM.read(256));
}

BeWayne:
Step by step as running before I can walk will trip me up.

That's the way to build understanding.

it is, but whilst I have now got something that works for the mobile number as entered, I am not sure I understand it properly.

whilst I get what certain parts of it are doing I don't fully understand, but having a play and see if I can gain a better understanding later

code extracted from:-

changes in my code:-

added pre setup();

const int EEPROM_MIN_ADDR = 0;
const int EEPROM_MAX_ADDR = 1023;
boolean eeprom_is_addr_ok(int addr) {
return ((addr >= EEPROM_MIN_ADDR) && (addr <= EEPROM_MAX_ADDR));
}
boolean eeprom_write_bytes(int startAddr, const byte* array, int numBytes) {
// counter
int i;
if (!eeprom_is_addr_ok(startAddr) || !eeprom_is_addr_ok(startAddr + numBytes)) {
return false;
}
for (i = 0; i < numBytes; i++) {
EEPROM.update(startAddr + i, array*);*
}
return true;
}
boolean eeprom_write_string(int addr, const char* string) {
int numBytes; // actual number of bytes to be written
//write the string contents plus the string terminator byte (0x00)
numBytes = strlen(string) + 1;
return eeprom_write_bytes(addr, (const byte*)string, numBytes);
}
boolean eeprom_read_string(int addr, char* buffer, int bufSize) {
byte ch; // byte read from eeprom
int bytesRead; // number of bytes read so far
if (!eeprom_is_addr_ok(addr)) { // check start address
return false;
}
if (bufSize == 0) { // how can we store bytes in an empty buffer ?
return false;
}
// is there is room for the string terminator only, no reason to go further
if (bufSize == 1) {
buffer[0] = 0;
return true;
}
bytesRead = 0; // initialize byte counter
ch = EEPROM.read(addr + bytesRead); // read next byte from eeprom
buffer[bytesRead] = ch; // store it into the user buffer
bytesRead++; // increment byte counter
while ( (ch != 0x00) && (bytesRead < bufSize) && ((addr + bytesRead) <= EEPROM_MAX_ADDR) ) {
// if no stop condition is met, read the next byte from eeprom
ch = EEPROM.read(addr + bytesRead);
buffer[bytesRead] = ch; // store it into the user buffer
bytesRead++; // increment byte counter
}
if ((ch != 0x00) && (bytesRead >= 1)) {
buffer[bytesRead - 1] = 0;
}
return true;
}
const int BUFSIZE = 15;
char buf[BUFSIZE];
String myString;
char myStringChar[BUFSIZE];
added in Current();- //so I can read the data without having to input again
eeprom_read_string(0, buf, BUFSIZE);
Serial.println(buf);
added in Number():-

Serial.println("Saving variable string to address 0");

myString=no1; //changed this line to use the string as inputed in the serial monitor, rather than the pre formatted number.
myString.toCharArray(myStringChar, BUFSIZE); //convert string to char array
strcpy(buf, myStringChar);
eeprom_write_string(0, buf);
Serial.print("Reading string from address 0: ");
eeprom_read_string(0, buf, BUFSIZE);
Serial.println(buf);

My code that's working and storing to EEPROM for the number.
```
*#include <SoftwareSerial.h>
#include <EEPROM.h>
SoftwareSerial mySerial(7, 8);
int EE1;
String no1;
String SMS1;
String ATD1= "ATD" + no1+";";

String Message2="Alarm";
String Siteid="Home\r";
String Message;
String Message1="Arm";

const int EEPROM_MIN_ADDR = 0;
const int EEPROM_MAX_ADDR = 1023;
boolean eeprom_is_addr_ok(int addr) {
return ((addr >= EEPROM_MIN_ADDR) && (addr <= EEPROM_MAX_ADDR));
}
boolean eeprom_write_bytes(int startAddr, const byte* array, int numBytes) {
// counter
int i;
if (!eeprom_is_addr_ok(startAddr) || !eeprom_is_addr_ok(startAddr + numBytes)) {
return false;
}
for (i = 0; i < numBytes; i++) {
EEPROM.update(startAddr + i, array[i]);
}
return true;
}
boolean eeprom_write_string(int addr, const char* string) {
int numBytes; // actual number of bytes to be written
//write the string contents plus the string terminator byte (0x00)
numBytes = strlen(string) + 1;
return eeprom_write_bytes(addr, (const byte*)string, numBytes);
}
boolean eeprom_read_string(int addr, char* buffer, int bufSize) {
byte ch; // byte read from eeprom
int bytesRead; // number of bytes read so far
if (!eeprom_is_addr_ok(addr)) { // check start address
return false;
}

if (bufSize == 0) { // how can we store bytes in an empty buffer ?
return false;
}

// is there is room for the string terminator only, no reason to go further
if (bufSize == 1) {
buffer[0] = 0;
return true;
}

bytesRead = 0; // initialize byte counter
ch = EEPROM.read(addr + bytesRead); // read next byte from eeprom
buffer[bytesRead] = ch; // store it into the user buffer
bytesRead++; // increment byte counter

while ( (ch != 0x00) && (bytesRead < bufSize) && ((addr + bytesRead) <= EEPROM_MAX_ADDR) ) {
// if no stop condition is met, read the next byte from eeprom
ch = EEPROM.read(addr + bytesRead);
buffer[bytesRead] = ch; // store it into the user buffer
bytesRead++; // increment byte counter
}
if ((ch != 0x00) && (bytesRead >= 1)) {
buffer[bytesRead - 1] = 0;
}
return true;
}
const int BUFSIZE = 15;
char buf[BUFSIZE];
String myString;
char myStringChar[BUFSIZE];

///
void setup()

{

mySerial.begin(9600);  // Setting the baud rate of GSM Module
  Serial.begin(9600);    // Setting the baud rate of Serial Monitor (Arduino)
  delay(100);

}

void loop()

{
  if (Serial.available()>0)
  switch(Serial.read())
 
  { 
    case '1':
   
    Message = Siteid+Message1;
    SendMessage();
    break;

case '2':
    Message = Siteid+Message2;
    SendMessage();
    break;
 
    case'd':
    DialCall();
    break;

case 'm':
    Number();
    break;

case 'n':
    Current();
    break;
 
  default:
      RecieveMessage();
      break;
      }

if (mySerial.available()>0)
  Serial.write(mySerial.read());
 
}

void SendMessage()
{
 
  mySerial.println("AT+CMGF=1");    //Sets the GSM Module in Text Mode
  delay(1000);  // Delay of 1000 milli seconds or 1 second
  SMS1 ="AT+CMGS="" + no1 + ""\n\r";
  mySerial.println(SMS1); // Replace x with mobile number mySerial.println("AT+CMGS="xxxxxxxxxx"\n\r");
  delay(1000);
  mySerial.println(Message);// The SMS text you want to send
  delay(100);
  mySerial.println((char)26);// ASCII code of CTRL+Z
  delay(1000);

}

void RecieveMessage()

{
  mySerial.println("AT+CNMI=2,2,0,0,0\r"); // AT Command to recieve a live SMS
  delay(1000);
}

void DialCall()
{
 
  mySerial.println(ATD1); // ATDxxxxxxxxxx; -- watch out here for semicolon at the end!!"ATD07815698180;"
  delay(30000);
  mySerial.println("ATH");
  delay(10000);
  mySerial.println("ATDL");
}

void Number()
{Serial.println(" Enter Mobile Number:");// prompt user input
while(Serial.available()==0){}//wait for user input
no1 = Serial.readString(); //read input
Serial.println(no1);

/Serial.println(" Enter EEPROM value");// prompt user input
while(Serial.available()==0){}//wait for user input
EE1 = Serial.parseInt(); //read input
EEPROM.update(256,EE1);
Serial.println(EEPROM.read(256));
/

//
Serial.println("Saving variable string to address 0");
myString=no1;
myString.toCharArray(myStringChar, BUFSIZE); //convert string to char array
strcpy(buf, myStringChar);
eeprom_write_string(0, buf);
Serial.print("Reading string from address 0: ");
eeprom_read_string(15, buf, BUFSIZE);
Serial.println(buf);
//

}

void Current()
{Serial.println("Current Mobile No:");
eeprom_read_string(15, buf, BUFSIZE);
Serial.println(buf);
//
}*
```

Okay, I have now increased it 2 numbers being entered and that seems to be okay,

the only things that are changing is the string for the mobile number being entered, the memory read and write positions.

Serial.println("Saving variable string to address 0");
myString=no1;
myString.toCharArray(myStringChar, BUFSIZE); //convert string to char array
strcpy(buf, myStringChar);
eeprom_write_string(0, buf); 
Serial.print("Reading string from address 0: ");
eeprom_read_string(0, buf, BUFSIZE);
Serial.println(buf);

Serial.println("Saving variable string to address 11");
myString=no2;
myString.toCharArray(myStringChar, BUFSIZE); //convert string to char array
strcpy(buf, myStringChar);
eeprom_write_string(11, buf); 
Serial.print("Reading string from address 11: ");
eeprom_read_string(11, buf, BUFSIZE);
Serial.println(buf);

so need to look at making this smarter (less code to do the same thing).

Think I can clos this down and move on.

storing 10 digits in 5bytes is possible
poc for 9 digits in 4bytes:

unsigned long final_number = 0;
byte number[9] = {0};
unsigned long hundred_millions = 0;
unsigned long ten_millions = 0;
unsigned long millions = 0;
unsigned long hundred_thousands = 0;
unsigned long ten_thousands = 0;
unsigned int thousands = 0;
unsigned int hundreds = 0;
byte tens = 0;
byte unit = 0;
byte c = 0;
byte i = 0;
bool flag = 0;

void setup() {
  Serial.begin(115200);
  Serial.print("Enter 9 digit phone number please:");
  while (!(Serial.available() == 10)) {}
  while ((c = Serial.read()) != '\n') {
    number[i] = c - 48;
    Serial.write(number[i] + 48);
    i++;
    if (i > 10) {
      flag = 1;
      Serial.println(F("too many numbers try again"));
      break;
    }
  }
  Serial.println("");
  if (!flag) {
    hundred_millions = number[0] * 100000000L;
    ten_millions = number[1] * 10000000L;
    millions = number[2] * 1000000L;
    hundred_thousands = number[3] * 100000L;
    ten_thousands = number[4] * 10000L;
    thousands = number[5] * 1000;
    hundreds = number[6] * 100;    
    tens = number[7] * 10;
    unit = number[8] * 1;

    final_number+= hundred_millions;
    final_number+= ten_millions;
    final_number+=millions;
    final_number += hundred_thousands;
    final_number+=ten_thousands;
    final_number+=thousands;
    final_number+=hundreds;
    final_number+=tens;
    final_number+=unit;
    
    Serial.print(F("phone number="));
    Serial.println(final_number);
    Serial.print(F("size of final_number in bytes="));
    Serial.println(sizeof(final_number));
  }
  else Serial.println(F("you did some mistakes"));
}

void loop() {
  // put your main code here, to run repeatedly:

}

output:

Enter 9 digit phone number please:476866985
phone number=476866985
size of final_number in bytes=4

via 1 small function numbers can be decoded back if needed.

Okay, thought I had this licked but.......

having issues with SMS1 not storing now and thought I had all three working earlier.

updated to void Current() // when run it prints out the 3 stored values.

void Current()
{
  /*Serial.println("Current Mobile No:");
}
eeprom_read_string(0, buf, BUFSIZE);
Serial.println(buf);
Serial.println("Current Mobile No 2:");
eeprom_read_string(11, buf, BUFSIZE);
Serial.println(buf);*/
//
int i;
  for (i = 0; i < 3; i++) {
  Serial.print("Current Mobile No:");
  Serial.println(i+1);
eeprom_read_string((i*11), buf, BUFSIZE);
Serial.println(buf);
}
}

created a TestLoop() rather than edit the existing number()

code below:- // this should allow the three numbers to be inputed into EEPROM, however currently only appears to be work for 2 and 3, confirmation and possible solutions appreciated, or what to look at.

void TestLoop()
{
  int i;
  for (i = 0; i < 3; i++) {
    Serial.print("Input Mobile Number: ");
    Serial.println(i+1);
  
    while(Serial.available()==0){}//wait for user input
    no1 = Serial.readString(); //read input
    Serial.println(i+1);
    Serial.println(no1);
    if(no1.startsWith("SMS"+((i+1)),0)){  
      delay(20);
    Serial.print("Saving variable string to address: ");
    Serial.println(i*11);
    delay(20);
    no1s = no1.substring(4);
    myString=no1s;
    delay(20);
    myString.toCharArray(myStringChar, BUFSIZE); //convert string to char array
    strcpy(buf, myStringChar);
    delay(20);
    eeprom_write_string((i*11), buf); 
    delay(20);
    Serial.print("Reading string from address : ");
    Serial.println(i*11);
    eeprom_read_string((i*11), buf, BUFSIZE);
    Serial.println(buf);
    delay(20);
  
    }
    
    
    
  }

}

surepic:
storing 10 digits in 5bytes is possible
poc for 9 digits in 4bytes:
. . .

People used to program like that to save a couple of bytes when storing a date and caused a big mess leading up to 01.01.2000 :slight_smile:
For storing a telephone number in a similar way, you’d have to convert the numbers to full international format (E164) and recreate the ‘+’ symbol, or add a flag indicating the number of leading zeros (if any).

think it be overly complicated storing 10 digits in 5 bytes, well for now anyway

fixed the issue on first number not storing I think, well it tested out okay more than once.

so full code currently:-

#include <SoftwareSerial.h>
#include <EEPROM.h>
SoftwareSerial mySerial(7, 8);
String no1s;
String no1;
String no2;
String SMS1;
String ATD1= "ATD" + no1+";";

String Message2="Alarm";
String Siteid="Home\r";
String Message;
String Message1="Arm";

const int EEPROM_MIN_ADDR = 0;
const int EEPROM_MAX_ADDR = 1023;
boolean eeprom_is_addr_ok(int addr) {
return ((addr >= EEPROM_MIN_ADDR) && (addr <= EEPROM_MAX_ADDR));
}
boolean eeprom_write_bytes(int startAddr, const byte* array, int numBytes) {
// counter
int i;
if (!eeprom_is_addr_ok(startAddr) || !eeprom_is_addr_ok(startAddr + numBytes)) {
return false;
}
for (i = 0; i < numBytes; i++) {
EEPROM.update(startAddr + i, array[i]);
}
return true;
}
boolean eeprom_write_string(int addr, const char* string) {
int numBytes; // actual number of bytes to be written
//write the string contents plus the string terminator byte (0x00)
numBytes = strlen(string) + 1;
return eeprom_write_bytes(addr, (const byte*)string, numBytes);
}
boolean eeprom_read_string(int addr, char* buffer, int bufSize) {
byte ch; // byte read from eeprom
int bytesRead; // number of bytes read so far
if (!eeprom_is_addr_ok(addr)) { // check start address
return false;
}

if (bufSize == 0) { // how can we store bytes in an empty buffer ?
return false;
}

// is there is room for the string terminator only, no reason to go further
if (bufSize == 1) {
buffer[0] = 0;
return true;
}

bytesRead = 0; // initialize byte counter
ch = EEPROM.read(addr + bytesRead); // read next byte from eeprom
buffer[bytesRead] = ch; // store it into the user buffer
bytesRead++; // increment byte counter

while ( (ch != 0x00) && (bytesRead < bufSize) && ((addr + bytesRead) <= EEPROM_MAX_ADDR) ) {
// if no stop condition is met, read the next byte from eeprom
ch = EEPROM.read(addr + bytesRead);
buffer[bytesRead] = ch; // store it into the user buffer
bytesRead++; // increment byte counter
}
if ((ch != 0x00) && (bytesRead >= 1)) {
buffer[bytesRead - 1] = 0;
}
return true;
}
const int BUFSIZE = 12;
char buf[BUFSIZE];
String myString; 
char myStringChar[BUFSIZE];

///
void setup()

{

 mySerial.begin(9600);   // Setting the baud rate of GSM Module 
 Serial.begin(9600);    // Setting the baud rate of Serial Monitor (Arduino)
 delay(100);

}

void loop()

{
 if (Serial.available()>0)
  switch(Serial.read())
 
 {  
   case '1':
   
    Message = Siteid+Message1;
    SendMessage();
    break;

    case '2':
    Message = Siteid+Message2;
    SendMessage();
    break;
  
    case'd':
    DialCall();
    break;

    case 'm':
    Number();
    break;

    case 'n':
    Current();
    break;
case 't':
  TestLoop();
  break;
  default:
     RecieveMessage();
     break;
     }

if (mySerial.available()>0)
  Serial.write(mySerial.read());
 
}

void SendMessage()
{ 
 eeprom_read_string(0, buf, BUFSIZE);
 Serial.println(buf);
 no1 =buf;
 mySerial.println("AT+CMGF=1");    //Sets the GSM Module in Text Mode
 delay(1000);  // Delay of 1000 milli seconds or 1 second
 SMS1 ="AT+CMGS=\"" + no1 + "\"\n\r";
 mySerial.println(SMS1); // Replace x with mobile number mySerial.println("AT+CMGS=\"xxxxxxxxxx\"\n\r");
 delay(1000);
 mySerial.println(Message);// The SMS text you want to send
 delay(100);
 mySerial.println((char)26);// ASCII code of CTRL+Z
 delay(1000);

}

void RecieveMessage()

{ mySerial.println("AT+CMGL=\"ALL\"\r");
 mySerial.println("AT+CNMI=2,2,0,0,0\r"); // AT Command to recieve a live SMS
  delay(1000);
}

void DialCall()
{
 
 mySerial.println(ATD1); // ATDxxxxxxxxxx; -- watch out here for semicolon at the end!!"ATD07815698180;"
 delay(30000);
 mySerial.println("ATH");
 delay(10000);
 mySerial.println("ATDL");
}

void Number()
{ Serial.println("Enter Mobile Number:");// prompt user input
while(Serial.available()==0){}//wait for user input
no1 = Serial.readString(); //read input
//Serial.println(no1);
if(no1.startsWith("SMS1",0)){
Serial.println("Saving variable string to address 0");
no1s = no1.substring(4);
myString=no1s;
myString.toCharArray(myStringChar, BUFSIZE); //convert string to char array
strcpy(buf, myStringChar);
eeprom_write_string(0, buf); 
Serial.print("Reading string from address 0: ");
eeprom_read_string(0, buf, BUFSIZE);
Serial.println(buf);}
else{
if(no1.startsWith("SMS2",0)){
Serial.println("Saving variable string to address 11:");
no1s = no1.substring(4);
myString=no1s;
myString.toCharArray(myStringChar, BUFSIZE); //convert string to char array
strcpy(buf, myStringChar);
eeprom_write_string(11, buf); 
Serial.print("Reading string from address 11: ");
eeprom_read_string(11, buf, BUFSIZE);
Serial.println(buf);
}
}}
void Current()
{
 /*Serial.println("Current Mobile No:");
}
eeprom_read_string(0, buf, BUFSIZE);
Serial.println(buf);
Serial.println("Current Mobile No 2:");
eeprom_read_string(11, buf, BUFSIZE);
Serial.println(buf);*/
//
int i;
 for (i = 0; i < 3; i++) {
 Serial.print("Current Mobile No:");
 Serial.println(i+1);
eeprom_read_string((i*11), buf, BUFSIZE);
Serial.println(buf);
}
}

void TestLoop()
{
 int i;
 for (i = 0; i < 3; i++) {
   Serial.print("Input Mobile Number: ");
   Serial.println(i+1);
 Serial.println("Awaiting Input"+i);
   while(Serial.available()==0){}//wait for user input
   
   no1 = Serial.readString(); //read input
   //Serial.println(i+1);
   Serial.println(no1);
   if(no1.startsWith("SMS",0)){  
   Serial.println(i+1);
  
   Serial.print("Saving variable string to address: ");
   Serial.println(i*11);
   no1s = no1.substring(4);
   myString=no1s;
  
   myString.toCharArray(myStringChar, BUFSIZE); //convert string to char array
   strcpy(buf, myStringChar);

   eeprom_write_string((i*11), buf); 

   Serial.print("Reading string from address : ");
   Serial.println(i*11);
   eeprom_read_string((i*11), buf, BUFSIZE);
   Serial.println(buf);
 
 
   }
   
   
   
 }

}

@6v6gt
It was just a concept :slight_smile: for me was interesting if its possible. If + sign will not change it can be added when decoding. For storing large ammount of numbers savings will become significant. 5bytes vs 10bytes.
For 8kb eeprom 1638numbers vs 819.