Hi
My sim900 won't receive messages, i can't figure out why.
After that i need to find out how i get it to reply to my messages automatically.
It says:
GSM Shield testing.
DB:NO RESP
Please help
#include "SIM900.h"
#include <SoftwareSerial.h>
//If not used, is better to exclude the HTTP library,
//for RAM saving.
//If your sketch reboots itself proprably you have finished,
//your memory available.
//#include "inetGSM.h"
//If you want to use the Arduino functions to manage SMS, uncomment the lines below.
#include "sms.h"
SMSGSM sms;
char pos;
//To change pins for Software Serial, use the two lines in GSM.cpp.
//GSM Shield for Arduino
//www.open-electronics.org
//this code is based on the example of Arduino Labs.
//Simple sketch to send and receive SMS.
int numdata;
boolean started=false;
char smsbuffer[160];
char str1[16];
char str2[16];
char n[20];
void setup()
{
//Serial connection.
Serial.begin(9600);
Serial.println("GSM Shield testing.");
//Start configuration of shield with baudrate.
//For http uses is raccomanded to use 4800 or slower.
if (gsm.begin(2400)) {
Serial.println("\nstatus=READY");
started=true;
} else Serial.println("\nstatus=IDLE");
if(started) {
//Enable this two lines if you want to send an SMS.
if (sms.SendSMS("5010", "balance"))
Serial.println("\nSMS sent OK");
}
sms.DeleteSMS(sms.IsSMSPresent(SMS_UNREAD));
};
void loop()
{
if(started) {
//Read if there are messages on SIM card and print them.
/** deprecated method
if(gsm.readSMS(smsbuffer, 160, n, 20)) {
Serial.println(n);
Serial.println(smsbuffer);
}
**/
//get 1st sms
sms.GetSMS(sms.IsSMSPresent(SMS_UNREAD),n,20,smsbuffer,160);
Serial.println(n);
Serial.println("Beskeden:");
Serial.println(smsbuffer);
strcpy(str1, smsbuffer);
strcpy(str2, "gps");
//sms.SendSMS("51503577", "test");
Serial.println("--------------------------");
Serial.println(str1);
Serial.println(str2);
Serial.println("--------------------------");
if (strcmp(str1, str2) == 0) {
sms.SendSMS(n, "test");
Serial.println("\nSMS sent OK");
}
delay(3000);
//sms.DeleteSMS(sms.IsSMSPresent(SMS_UNREAD));
}
};