lingeshbarani / gsm-shield-arduino

Automatically exported from code.google.com/p/gsm-shield-arduino
0 stars 0 forks source link

SIM900, erro ao salvar manipular SMS(mensagem) #106

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
SIM900, error handling when saving SMS (message)
  I'm trying to manipulate an SMS, there is an error that I can not fix.
I'm using an arduino uno, a shield SIM900 (IComSat v1.1)
My goal is to save a mesagem text, select it and starting characters of SMS and 
save in a variable.
types of variables that intend to use:
int
char

I'm trying velop a code for that, I'm not getting bad.
can anyone help me please
am new in this area

<pre>
<code>
///////////////////////////////////////////////////////////////////
#include <SoftwareSerial.h>
char inchar; 
SoftwareSerial SIM900(2, 3);
int led4 = 13;
int a0;
int a1;
char a2;
void setup()
{
  SIM900.println("AT+CMGD=1,4");
  Serial.begin(19200);
  pinMode(led4, OUTPUT);
  digitalWrite(led4, HIGH);
  SIM900.begin(19200);
  SIM900.print("AT+CMGF=1\r");  
  delay(100);
  SIM900.print("AT+CNMI=3,3,0,0,0\r");
  delay(100);
  Serial.println("Iniciando...");
}

void loop()
 {
  if(SIM900.available() >0)
    {
    Serial.println("new sms");
    inchar=SIM900.read();
    if (inchar[0]=='1') //character position 1
     {
     inchar[0]==a0;
     Serial.println("first variable saved");
     if (inchar[1]=='2') //character position 2
     {
      inchar[0]==a1; 

     if (inchar[2]=='e') //character position 3
      {
      inchar[0]==a2; 
     Serial.println(a1,a2,a3);
     digitalWrite(led4, LOW);
      }

      }

      }
       SIM900.println("AT+CMGD=1,4");
     }
}
///////////////////////////////////////////////////////////
<\code>

Original issue reported on code.google.com by bruno.da...@gmail.com on 23 Aug 2014 at 12:13