Hello i am currently using an sd card with the sim900 gsm to send a message to a mobile device in case my potentiometer goes above a certain number,the telephone number that i'm using is the same one that comes from the SD card,and i would like a way to be able to replace the full number with just the word telephone since i already made a variable called telephone with the number integrated into it,here is the code
#define potPin A0
char tab[80];
#include <SPI.h>
#include <SD.h>
String adresse;
String telephone;
String poub1;
String poub2;
String poub3;
#include <SoftwareSerial.h>
SoftwareSerial gsm(7, 8);
const int chipSelect = 4;
char carac=0;
void setup() {
pinMode(potPin, INPUT);
int i=0;
Serial.begin(9600);
while (!Serial) {;
}
Serial.print("Initialization SD card...");
if (!SD.begin(chipSelect)) {
Serial.println("échec de carte sd");
return;
}
Serial.println("card initialize.");
File dataFile = SD.open("config.txt");
if (Serial.read());
if (dataFile) {
while (dataFile.available()) {
tab[i]=dataFile.read();
Serial.write(tab[i]);
i++;
delay(10);
}
tab[i]='\0';
Serial.println();
dataFile.close();
delay(100);
gsm.print("AT+CMGF=1\r");
delay(100);
String neww = tab;
int deb = neww.indexOf('=');
int fin = neww.indexOf(';', deb+1);
adresse=neww.substring(deb + 1,fin);
Serial.println(adresse);
deb = neww.indexOf('=',fin+1);
fin = neww.indexOf(';', deb+1);
telephone=neww.substring(deb+ 1,fin);
Serial.println(telephone);
deb = neww.indexOf('=',fin+1);
fin = neww.indexOf(';', deb+1);
poub1=neww.substring(deb + 1,fin);
Serial.println(poub1);
deb = neww.indexOf('=',fin+1);
fin = neww.indexOf(';', deb+1);
poub2=neww.substring(deb + 1,fin);
Serial.println(poub2);
deb = neww.indexOf('=',fin+1);
fin = neww.indexOf(';', deb+1);
poub3=neww.substring(deb + 1,fin);
Serial.println(poub3);
}
else {
Serial.println("erreur ouvrir config.txt");
}
}
void loop() {
int val = analogRead(potPin);
Serial.println(val);
delay(500);
if(val>500)
{ Serial.println("help");
gsm.begin(19200);
delay(2000);
gsm.println("AT + CMGS = \"+33750499330\"");
delay(100);
gsm.println("help");
delay(100);
gsm.println((char)26) ;
delay(100);
gsm.println();}
}
gsm.println("AT + CMGS = "+xxxxxxxxxxx""); is what i am trying to replace with telephone istead of the number