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;
}
}
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]);
}
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.
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.