recall a select list of stored numbers

Want to combine a dial list say(235)with stored numbers list (07xxxxxxxx1 - 5), in this example we would list:-

078xxxxxxx2
078xxxxxxx3
078xxxxxxx5

and skip numbers 1 and 4.

// this recalls the numbers I want to dial ie: numbers 235  would mean I want to dial number 2 3 and 5 as 3 of the 5 numbers stored and from the second call list 134

void StatusCall() {
      const int BUFSIZE = 6;

  int i;
  for (i = 0; i < 2; i++) {
    mySerial.print("Call ");
    mySerial.print(i + 1);
    mySerial.print(": ");
    eeprom_read_string(((i + 19) * 5), buf, BUFSIZE);
    mySerial.println(buf);
  }
}

The following code retrieves numbers 07xxxxxxx1 to 07xxxxxxxx5 as a list of numbers.

 //this code retrieves the actual telephone numbers 1 to 5

void StatusTel() {
  int i;
  const int BUFSIZE = 12;
  for (i = 0; i < 5; i++) {
    mySerial.print("Telephone No ");
    mySerial.print(i + 1);
    mySerial.print(": ");
    eeprom_read_string((i * 11), buf, BUFSIZE);
    mySerial.println(buf);
  }
}

I had a go and came up with this so far, but it isn't right and need to spend dome more time on it, but this just effectively lists all 5 numbers 07xxxxx1 to 07xxxxx5

void StatusDiall1() {
  int i;
  const int BUFSIZE = 2;
  for (i = 168; i < 173; i++) {
    mySerial.print("Number dialed ");
    mySerial.print(i - 167);
    mySerial.print(": ");
    eeprom_read_string((i * 1), buf, BUFSIZE);
    //mySerial.println(buf);

   
    int j;
    sscanf(buf, "%d", &j);
    const int BUFSIZE = 12;
    j=j-1;
    eeprom_read_string((j * 11), buf, BUFSIZE);

    mySerial.println(buf);
          newMessage = false;

  
}
}

okay probably as clear as mud.

I have got to a stage where take the call list and separate each character out, just need to convert these in to int's and then insert them in the code to recall the full number.

int i;
const int BUFSIZE = 6;
eeprom_read_string(((i + 19) * 5), buf, BUFSIZE);
for (i = 0; i < 5; i++){ 
 mySerial.println(buf[i]);  
}

generates

2
3
5

int j;
int i;

const int BUFSIZE = 6;
eeprom_read_string(((i + 19) * 5), buf, BUFSIZE);

for (i = 0; i < 5; i++){ 
  mySerial.print("buf[i] = ");  
 mySerial.println(buf[i]);  
 j= buf[i]-'0';
  mySerial.print("j = ");  
 mySerial.println(j); 
}

this gives the same values for j as for buf*. *
2
3
5
when I add this code to the end:
```

  • const int BUFSIZE = 12;
    eeprom_read_string((j * 11), buf, BUFSIZE);
    mySerial.print(buf)*
    ```

I get
2
7
o for buf
63 for j
the print buf prints the mobile number 2 07xxxxxx2 and the rest are obviously out of sync due to the changes in buf changing which of couse this will change becuase of the new eeprom read line, however I havent a clue how to resolve this as yet. any suggestions am I missing something blatantly obvious and if so what and how should I think to find a solution.

Snippets of code rarely get answered here. I would suggest this: May an array of, perhaps, 10 numbers that emulates what you've stored in EEPROM. Then present the code you have, but using that array instead of the "real" EEPROM. That way, readers can work with your code rather than trying to create an EEPROM test base.

I know where the numbers have come from now or at least i think I do.

so I will look tomorrow at resolving, and or explaining better here for help.

I am still getting used to how people want to see all the code rather than the bit one is having trouble with.

A clear and complete problem statement would go a long way.

Are you the person that spamed-dial my phone everyday?

arduino_new:
Are you the person that spamed-dial my phone everyday?

Ahem:
Are you the person that who spamed spammed-dialed my phone everyday?

(Couldn't resist...)

lol unlikely as the number wouldn't be dialling out at present.

priority is to get the numbers recalled corectly based on the call list.

Got it sorted.

void StatusDiall1() {
char num[5];
int j;
int i;
const int BUFSIZE = 6;
eeprom_read_string(((i + 19) * 5), num, BUFSIZE); // dial list (235)

for (i = 0; i < 5; i++) {  // get numbers based on dial list
j=num[i]-'1';
if(j>=0){
const int BUFSIZE = 12;
eeprom_read_string((j * 11), buf, BUFSIZE);
mySerial.println(buf);}else{
 mySerial.println("finished");
}
  }
          newMessage = false;
}

Now I have that sorted I guess I need to know if there is a smarter way to write the same thing.

writing down in the forum apears to be helping me no end if noting else keeping track of whats been done so I dont rpeat the same mistake too many times.

Reason why it wasn't working is the first eeprom line gives buf as 235 in the test case, buf[0]=2, buf[1]=3 etc
The second eeprom line to recall the number gives 07xxxxxxxx2 then we are looking at buf[1]=7 and so on.

so solution not to have two buf.