Go Down

Topic: SIM900 GSM MODULE (Read 44 times) previous topic - next topic

Kier925

Can someone please help me I got a problem in the serial monitor:

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

DB:ELSE
ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

DB:ELSE
ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

ATT: OK
RIC: AT

DB:ELSE
ATT: OK
RIC: AT

ATT: OK
RIC: AT



Here is my code:

#include "SIM900.h"
#include "sms.h"
SMSGSM sms;
int numdata;
boolean started = false;
char smsbuffer[160];
char n[20];
int smsValue;
char sms_position;
char phone_number[20];
char sms_text[100];
int i;

void setup()
{
  Serial.begin(19200);
  pinMode(12, OUTPUT);
  if (gsm.begin(19200))
  {
    Serial.println("\nstatus=READY");
    started = true;
  }
  else
    Serial.println("\nstatus=IDLE");

  if (started)
  {
    for (i = 1; i <= 20; i++)
    {
      sms.DeleteSMS(i);
    }
    if (sms.SendSMS("+639954709282", "HELLO THIS IS FEEDOMATIC FEEDING THROUGH SMS IS STARTED"))
    {
      Serial.println("\nSMS sent OK.");
    }
    else
    {
      Serial.println("\nError sending SMS.");
    }
  }
};

void loop()
{
  if (started)
  {
    sms_position = sms.IsSMSPresent(SMS_UNREAD);
    if (sms_position)
    {
      Serial.print("SMS postion:");
      Serial.println(sms_position, DEC);
      sms.GetSMS(sms_position, phone_number, sms_text, 100);
      Serial.println(phone_number);
      Serial.println(sms_text);


      if (strcmp(sms_text, "on") == 0) {
        digitalWrite(12,HIGH);
             delay(100);
      }

      if (strcmp(sms_text, "off") == 0) {
                digitalWrite(12,LOW);
             delay(100);
      }
    }
    delay(2000);
  }
}

Go Up