SIM900 - Receive SMS problem

Hello everybody,

I have a very strange problem with my SIM900. I can send an SMS from my Arduino but I can not receive.

Here are the codes:

https://drive.google.com/file/d/0B5RP5NsysFygMHRZQThrdURXc0E/view

I have done everything from that tutorial. Also, I have tried to use hardvare serial instead of software serial, but doesn’t help.

I have also tried this code:

#include <SoftwareSerial.h>

SoftwareSerial GPRS(7, 8);

unsigned char buffer[64];  // buffer array for data receive over serial port
int count=0;               // counter for buffer array 

void setup()
{
  GPRS.begin(19200);
  Serial.begin(19200);
}

void loop()
{
  if (GPRS.available())
  {
    while(GPRS.available())
    {
      buffer[count++]=GPRS.read();
      if(count == 64)break;
    }
    Serial.write(buffer,count);
    clearBufferArray();
    count = 0;
  }
  if (Serial.available())
    GPRS.write(Serial.read());
}

void clearBufferArray()
{
  for (int i=0; i<count;i++)
  {
    buffer[i]=NULL;
  }
}

and to test AT commands, but nothing happends.

Can someone help me?

Can you give the hardware you used so sir? So that you can be helped.

andreaspawelski:
Hello
i have to receive for any function an message return of the function.
i have make examples without errors but it not go on.
the example is

bool inviosms = true ;

bool inviosmsred = true;
if (inviosms == true ) {
        sms.SendSMS(Mittente, “STATUS:red on,yell off,black of,blue off, green off”);
        inviosms = false;




the sketch code function with gsm fine.



#include “SIM900.h”
#include <SoftwareSerial.h>
#include “sms.h”
String textMessage;
// TX  CON RX — RX  CON TX-- PORTA 1/2 OPPURE  7/8  SIM 900
const int red = 13;
const int green = 12;
const int blue = 11;
const int black = 10;
const int yell = 9;

SMSGSM sms;

boolean started = false;
char smsbuffer[160];
char Mittente[20];

void setup()
{
 //set led as output
 pinMode(red, OUTPUT);
 pinMode(green, OUTPUT);
 pinMode(blue, OUTPUT);
 pinMode(black, OUTPUT);
 pinMode(yell, OUTPUT);
  //by default the leds is off
 digitalWrite(red, LOW);
 digitalWrite(green, LOW);
 digitalWrite(blue, LOW);
 digitalWrite(black, LOW);
 digitalWrite(yell, LOW);
 Serial.begin(9600);
 Serial.println(“GSM Shield testing.”);
 Serial.println(“AT+CMGF=1”);    //Sets the GSM Module in Text Mode
delay(1000);
Serial.println(“AT+CNMI=2,2,0,0,0r”); // AT Command to receive a live SMS
delay(1000);
Serial.println(“AT+CMGDA=r”);
delay(1000);
Serial.println(“DEL ALL”);
 if (gsm.begin(4800)) {
   Serial.println(“nstatus=READY”);
   started = true;
 } else {
   Serial.println(“nstats=iDLE”);
 }
}

char phone_number[20];
char sms_text[100];

void loop(){
 if (started) {
   char sms_position = sms.IsSMSPresent(SMS_UNREAD);
   if (sms_position) {
   //Serial.print(SMS position:");++
   //Serial.printLn(sms_positione,DEC);++
   sms.GetSMS(sms_position, phone_number, sms_text,100);
   Serial.println(sms_text);
   String msg = String(sms_text);
   if (msg.indexOf(“yellon”) >= 0) {
   Serial.println(“ON”);
    digitalWrite(9,HIGH);
     }
    if (msg.indexOf(“yelloff”) >= 0) {
      Serial.println(“OFF”);
      digitalWrite(9,LOW); }
      if (msg.indexOf(“blackon”) >= 0) {
   Serial.println(“ON”);
    digitalWrite(10,HIGH);
     }
    if (msg.indexOf(“blackoff”) >= 0) {
      Serial.println(“OFF”);
      digitalWrite(10,LOW); }
      if (msg.indexOf(“blueon”) >= 0) {
   Serial.println(“ON”);
    digitalWrite(11,HIGH);
     }
    if (msg.indexOf(“blueoff”) >= 0) {
      Serial.println(“OFF”);
      digitalWrite(11,LOW); }
      if (msg.indexOf(“greenon”) >= 0) {
   Serial.println(“ON”);
    digitalWrite(12,HIGH);
     }
    if (msg.indexOf(“greenoff”) >= 0) {
      Serial.println(“OFF”);
      digitalWrite(12,LOW); }
      if (msg.indexOf(“redon”) >= 0) {
   Serial.println(“ON”);
    digitalWrite(13,HIGH);
     }
    if (msg.indexOf(“redoff”) >= 0) {
      Serial.println(“OFF”);
      digitalWrite(13,LOW); }
      if (msg.indexOf(“allon”) >= 0) {
   Serial.println(“ON”);
     digitalWrite(red, HIGH);
     digitalWrite(green, HIGH);
     digitalWrite(blue, HIGH);
     digitalWrite(black, HIGH);
     digitalWrite(yell, HIGH);
     }
      if (msg.indexOf(“alloff”) >= 0) {
   Serial.println(“OFF”);
     digitalWrite(red, LOW);
     digitalWrite(green, LOW);
     digitalWrite(blue, LOW);
     digitalWrite(black, LOW);
     digitalWrite(yell, LOW);
     
 
  }  
   
  }
 }
 }




Thank's very much for any help.