I am running the Adafruit library-supplied sketch called Arduino/libraries/Adafruit_FONA/examples/FONAtest/FONAtest.ino
Most things seem to work (e.g., i shows me that I have enough signal strength, n shows me that the status=1 and it is registered, C finds my SIM card, c lets me call my cell phone or home phone, T plays audio tones, f plays the FM radio, etc.) but when I do s, put in my cell phone number and then type in a simple message (e.g., xx), it goes off and tries to send it, but it responds in the Serial window with "Failed".
I have been using debug statements in the Adafruit_FONA.cpp file and it fails at this "if" statement: if (strstr(replybuffer, "+CMGS") == 0) { return false; }
See my 'modified' .cpp code below:
Code: Select all
boolean Adafruit_FONA::sendSMS(char *smsaddr, char *smsmsg) {
if (! sendCheckReply("AT+CMGF=1", "OK")) return -1;
char sendcmd[30] = "AT+CMGS=\"";
strncpy(sendcmd+9, smsaddr, 30-9-2); // 9 bytes beginning, 2 bytes for close quote + null
sendcmd[strlen(sendcmd)] = '\"';
if (! sendCheckReply(sendcmd, "> ")) return false;
#ifdef ADAFRUIT_FONA_DEBUG
Serial.print("> "); Serial.println(smsmsg);
#endif
mySerial->println(smsmsg);
mySerial->println();
mySerial->write(0x1A);
#ifdef ADAFRUIT_FONA_DEBUG
Serial.println("^Z");
#endif
Serial.println("it gets to the SMS part that reads +CMGS reply"); // I added this
readline(10000); // read the +CMGS reply, wait up to 10 seconds!!!
//Serial.print("* "); Serial.println(replybuffer);
if (strstr(replybuffer, "+CMGS") == 0) {
Serial.println("fails at 1"); // I added this
return false;
}
readline(1000); // read OK
//Serial.print("* "); Serial.println(replybuffer);
if (strcmp(replybuffer, "OK") != 0) {
Serial.println("fails at 2"); // I added this
return false;
}
Serial.println("it gets to the SMS part that should be true"); // I added this
return true;
}
Here is what I get in the Serial window:
Code: Select all
FONA> i
RSSI = 8: -98 dBm
FONA> i
RSSI = 8: -98 dBm
FONA> i
RSSI = 8: -98 dBm
FONA> n
Network status 1: Registered (home)
FONA> s
Send to #1845------- (note: I did not want my phone number here)
Type out one-line message (140 char): xx
it gets to the SMS part that reads +CMGS reply
fails at 1
Failed
FONA>
BTW, I cannot send an SMS message from my cell phone to the FONA either. The FONA was able to get SMS messages the first day that I got the SIM card, but now it is not working. I got about 5 SMS messages from T-Mobile.
I'm using an Arduino Uno R2 if that matters.