Hi! good day everyone, I tried saving a phone number to SD card module and get it then use it to send a message. Whenever I do this in void setup, there's no message sent to my phone.
file = SD.open("numtext.txt");
number_to_send = readLine();
file.close();
SendMessage();
But whenever I do this, I works perfectly.
number_to_send = "09276476889";
SendMessage();
Is there any reason why I'm experiencing this?
PS. No problem with SD card module, it works perfectly.
void SendMessage(){
gsm.println("AT+CMGF=1");
delay(200);
gsm.println("AT+CMGS="" + number_to_send + ""\r");
delay(200);
String SMS = ("123s Dgb asfgbafg afgargb ar");
gsm.println(SMS);
delay(100);
gsm.println((char)26);// ASCII code of CTRL+Z
delay(200);
_buffer = _readSerial();
}
String _readSerial() {
_timeout = 0;
while (!gsm.available() && _timeout < 12000 )
{
delay(13);
_timeout++;
}
if (gsm.available()) {
return gsm.readString();
}
}